1. Some knowledge points
The Mysql.exe path (D:\program files\wamp\bin\mysql\mysql5.5.20\bin) can be added to the environment variable path in the system properties of the computer so that MySQL can be used in any directory. For example: input the MySQL system in CMD can be identified;
A database is made up of many tables, and you can use keys as a reference between tables.
2. Some of the commands and their use
A) Create the database: creation databases Suyd;
b) View the database that exists in the system: show databases;
c) Switch the database, the default current operation in this library: use Suyd;
d) View the tables that exist in the database suyd: show tables;
e) Creating tables: Create table users (ID int not NULL auto_increment primary key, username char (+) NOT null default ', PASSW Ord varchar (+) NOT null default ", age int. NOT NULL default 0, sex char (4) is not null default", email varchar (+) not Nu ll default "); (there is a point in quotation marks) '
f) View the created table: show tables;
g) View table users ' specific structure: desc users;
h) View the statement creating Table users: show create table users;
i) operation of the table
Insert : INSERT into users (IDs, username, password, age, sex, email) VALUES (' 1 ', ' suyd ', ' 123456 ', ' A ', ' Girl ', ' [email Protected] ');
Query table information for users: SELECT * from users;
modified : Update users set username = ' Su ' where id = 2;
Modify multiple values at the same time: Update users set age = n, sex = ' girl ';
Modify multiple values for a person at the same time: Update users set age = 1, sex = ' girl ' where-id = +;
Delete : Delete from users where id = 1;
Enquiry
Querying the table for all cases: SELECT * from users;
Query the case of an item in the table: Select ID, username from users;
To query the condition of an item in a table according to a requirement:
Select ID, username, age+10 as age10 from users;
Select ID, username, age from the users where age > 10;
j) Delete the entire table or library:
drop table users;
Drop database Suyd;
A review of some knowledge points in the database