Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What are tables?
#1
I was looking at learning SQL here, however, the tutorials are referencing these tables, now I'm wondering: where the hell did these tables come from? Is there a better tutorial someone can link me to, or possibly explain what they are trying to do? By the way, I realize I sound like I'm an idiot Big Grin
Reply
#2
Tables are fields insde your MySql Database, you can have unlimited amount of Databases and Tables are what those DBs hold.
Let's say you have a Emplyee database called "emplyee", that database would have tables like, workers and times

A structure would be for example,
DB Emplyee
TBL workers
- FIELD full_name
- FIELD age
...
TBL times
- FIELD user_id
- FIELD work_time

The Tables would then hold their own fields, like usr_id, user_avatar, etc...
Reply
#3
(12-21-2009, 01:10 PM)Master of The Universe Wrote: Tables are fields insde your MySql Database, you can have unlimited amount of Databases and Tables are what those DBs hold.
Let's say you have a Emplyee database called "emplyee", that database would have tables like, workers and times

A structure would be for example,
DB Emplyee
TBL workers
- FIELD full_name
- FIELD age
...
TBL times
- FIELD user_id
- FIELD work_time

The Tables would then hold their own fields, like usr_id, user_avatar, etc...

I found this kind of confusing - it would make more sense to have a table called Employees, and a database called workplace.

Other tables in the workplace database could include things such as inventory and sales.

The employees table would look something like

Code:
| user_id | salary | work_time | full_name | age |

A sample sql query to grab a certain employees age would look something like:

Code:
SELECT salary FROM Employees WHERE user_id = 1234
Note: My sql is rusty as balls, it's possible I'm not entirely correct, but I'm sure I"ll be corrected if I'm not.

Anyways, that would return the salary of whichever worker had an id of 1234.
Reply
#4
Ohh yeah your're right about the Database, and there isn't anything wrong with SQL.
But it seems you did explained my fail well....
I was typing fast and thinking faster, happens Tongue
Reply
#5
(12-21-2009, 01:21 PM)Master of The Universe Wrote: Ohh yeah your're right about the Database, and there isn't anything wrong with SQL.
hehe, awesome. I've only worked with sql once, this summer, while reading a php book Tongue

Quote:But it seems you did explained my fail well....
I was typing fast and thinking faster, happens Tongue

That's okay, mistakes happen. You still gave a good explanation. Big Grin
Reply
#6
This makes no sence to me O.o. Im not really sure why. is
| user_id | salary | work_time | full_name | age |
actual syntax?
Reply
#7
(12-21-2009, 03:56 PM)nevets04 Wrote: This makes no sence to me O.o. Im not really sure why. is
| user_id | salary | work_time | full_name | age |
actual syntax?

No, you have to think of it in a less practical sense. Imagine creating a table in a word document. At the top you have a title. user_id, salary, work_time, full_name, and age are your titles.

From here, each row contains information about the same person. For example, take a look at the following:

Code:
| user_id | salary | work_time | full_name     | age |
| 1232     | $10h  | 3 weeks    | Martin smith | 20    |

That row contains information about a man named Martin Smith. Let's say you knew his name, but you wanted to find out what his salary is.

Your query would look something like
Code:
SELECT salary FROM Employees WHERE full_name = "Martin Smith"

SQL queries sort of make sense as you read them. This is selecting the salary column from the employees gable where the name is "Martin Smith". This will return $10h. Make sense?
Reply
#8
I understand the query, but how do you make the table?
Reply
#9
(12-21-2009, 07:44 PM)nevets04 Wrote: I understand the query, but how do you make the table?

there's a mysql command line for making tables, but there's an easier way to do it.

It's a super-slick webapp called phpmyadmin. It's in apt-get's repo's (I believe), and should be in yum's, too.

Here's their website, http://www.phpmyadmin.net/home_page/index.php.

Not only do they help you make tables, it also (among other things) lets you see an aesthetically pleasing visual representation of your tables. ;).
Reply
#10
Code:
An error has been encountered in accessing this page.

1. Server: www.phpmyadmin.net
2. URL path: /home_page/index.php.
3. Error notes: NONE
4. Error type: 404
5. Request method: GET
6. Request query string: NONE
7. Time: 2009-12-22 02:50:54 UTC (1261450254)

Reporting this problem: The problem you have encountered is with a project web site hosted by SourceForge.net. This issue should be reported to the SourceForge.net-hosted project (not to SourceForge.net).

If this is a severe or recurring/persistent problem, please do one of the following, and provide the error text (numbered 1 through 7, above):

   1. Contact the project via their designated support resources.
   2. Contact the project administrators of this project via email (see the upper right-hand corner of the Project Summary page for their usernames) at user-name@users.sourceforge.net

If you are a maintainer of this web content, please refer to the Site Documentation regarding web services for further assistance.

NOTE: As of 2008-10-23 directory index display has been disabled by default. This option may be re-enabled by the project by placing a file with the name ".htaccess" with this line:

Options +Indexes
I got an error.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)