SQL Basic Operations
Basic operations: CRUD, additions and deletions
The basic operations of SQL are categorized according to the object of operation:
1. Library operation
2. Table operation
3. Data manipulation
Library Operations:
To change the database and delete the search
New database:
Basic syntax:
1 Create database name [ library option ];
Library options: Used to constrain the database, divided into two options: 1, Character set: Charset/character set specific character set (data storage encoding format, Chinese common character set GBK and UTF8.). 2, Proofing Set set: Collate specific proofing Set (data comparison rules).
For example:
Where: The database name cannot be used for keywords (characters that have already been used) or reserved words.
If you do not want to use keywords or reserved words, you must use the anti-quote. (Enter ' in the English state below ESC).
What happens after the SQL statement that created the database was executed?
1, in the database system, increased the corresponding database information
2. In the folder where the data is saved: A folder that corresponds to the database name is created.
View Database
1. View all databases
1 show databases;
2. View the specified part of the database: Fuzzy query
1 Database like ' pattern ';
--pattern refers to the matching pattern:% (Percent semicolon): Indicates that multiple characters are matched. _ (Underscore): Represents a single character match.
3. View the database creation statement
1 Create database name;
Update Database
The database name is not modifiable.
Database modification is limited to library options: Character set and proofing set (small heap dependent character set).
Is
1 Alter database name [ library option ] Chaerset XXX;
Deleting a database
1 database name;
previous section: MySQL Basic notes (i)
next section: MySQL basic Note (iii)-table operation Basics
MySQL Basics note (ii)-SQL basic operations