The concept of a database
Database ( DATABASE,DB) is an organized, shared, and centrally managed collection of data that is stored in a computer for a long time. She is a computer software system that stores and manages data in accordance with the information structure. The concept of the database actually includes two layers of meaning: (1) The database is an entity, it is a "warehouse" that can reasonably keep the data, the user stores the transaction data to be managed in the "warehouse", the "Data" and "library" two concepts are combined into a database. (2) database is a new method and technology of data management, he can better organize data, more convenient maintenance data, tighter control data and more efficient utilization of data.
MySQL Entry statement
Operation of the database
Display Database
Show databases;
The effect is as follows:
Create a database
Create database name;
Use a database
use database name;
Deleting a database
Drop database name; Drop Fall
Operation of the table
Displaying tables in a database
Show tables; Enter the database first
Create a table
Create a table Create Table Table name ( Field 1 field type, Field 2 field type , field 3 field type)--------Createtable Class ( int, varchar), int );
View a table structure
Desc table name;
Renaming a table
Table to NewName;
Delete a table
Drop table name;
Operation of the field
Add Field
Alter Table Add field name fields type
Modify field names
Alter table name change old field name new field name fields type
modifying field types
Alter Table Table name modify (decorated) field name fields type
Delete a field
Alter Table Drop Field name
Modify field arrangement position
Command:
ALTER TABLE | After field name 2
Example 1:
ALTER TABLE VARCHAR (a) first; (insert field sname to the first position of the table)
Example 2:
ALTER TABLE INT (one) after sname; (Insert field sno after field sname)
MySQL Database concepts and introductory statements