Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What are tables?
#11
So here are the query strings
The first creates a new Database named test

Code:
CREATE DATABASE `test` ;

The next one creates a table named users inside of our test database
Code:
CREATE TABLE `test`.`users` (
`id` TINYINT( 3 ) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`ip` VARCHAR( 15 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL ,
`name` VARCHAR( 20 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL ,
`email` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL
) ENGINE = MYISAM ;

As you can see the users table have 4 fields, those hold the id, ip, username and email
example entry:
1 | 127.0.0.1 | Master | e@mail.net
2 | 127.0.0.2 | Nevets | n@mail.net
So the table users would now have two entries.
An example string for adding entries:

Code:
INSERT INTO `test`.`users` (
`id` ,
`ip` ,
`name` ,
`email`
)
VALUES (
NULL , '127.0.0.1', 'Master', 'e@mail.net'
);


But creating tables and DBs is better and fester done over your phpMyAdmin
http://localhost/phpmyadmin

There you will also start understanding the structure when you start creating stuff.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)