MySQL - Myweb @ CW Post
Download
Report
Transcript MySQL - Myweb @ CW Post
Quick-and-dirty
Commands end in a semi-colon
◦ If you forget, another prompt line shows up
Either continue the command or…
End it with a semi-colon
◦ Just like “DOS”…
No error message, and another command prompt
indicates that the command worked (assumption)
Just because it exists doesn’t mean that
you’re using it
◦ Issue the “USE DATABASE <name>” command
◦ Empty database
No tables exist in it
Use the CREATE TABLE command
◦ For the fields (columns) consider:
Names
Data type
Unique value in that table?
Index value?
Primary key?
Auto Increment?
Any default value?
Null or not null?
Note the continuation line for the command
◦ Field (column) definitions are separated by commas
Each field is described
SHOW TABLES command is issued to verify
the table exists
Use the “DESCRIBE” command
Use an “INSERT INTO” SQL command
Load records from another source
◦ From another table using SQL
◦ From a sequential file using the “LOAD” command
parts.txt
◦ Text file
◦ Semi-colon separated values
◦ Lines end on “newline” character
Command line interface (MySQL shell)
indicated that 3 records were affected
Use a “select” query to show the records