MySQL Connection
- - penter Password: ******
The mysql> Command Prompt window will appear after successful login
to The MySQL monitor....mysql >
Create a database after logging in
CREATE DATABASE IF not EXISTS DatabaseName;
Deleting a database
DROP DatabaseName;
Select Database
Use DatabaseName;
Create a data table
CREATE TABLE table_name (column_name column_type);
Create a data table example
CREATE TABLE IF not EXISTS' test_tbl ' (' test_id ' )INTUNSIGNED auto_increment, ' Test_title 'VARCHAR( -) not NULL, ' Test_author 'VARCHAR( +) not NULL, ' submission_date ' date,PRIMARY KEY(' test_id ')) ENGINE=InnoDBDEFAULTCHARSET=UTF8;
Delete a data table
DROP TABLE table_name;
Inserting data
INSERT into table_name (field1, Field2,... fieldn) VALUES (value1, value2,... valuen);
Querying data
SELECT Column_name,column_name from table_name [WHERE Clause] [[LIMIT N]
Using the WHERE clause
SELECT from table_name1, table_name2 ... [WHERE condition1 [and [OR]] condition2 .....
Example of reading data
SELECT * from WHERE Test_author='youngng';
Example of exporting data in SQL format
- - > Dump ******
Import SQL File data
MySQL>source Sqlfilepath;
MySQL Database common commands