SQL classification
SQL statements can be divided into 3 categoriesDDL: Data definition language, defining data segments, databases, data tables, and other DML: data manipulation statements for adding, deleting, updating, and querying database records DCL: Data control statements, statements that control the level of permission and access to different data segments directly
to get started, start MySQL service net start MySQL, go to MySQL, mysql-u root-p (U back with database user,-p indicates need to enter password)
1. DDL statements
The language in which objects inside the database are created, deleted, modified, and so on.
1.1 Creating a DatabaseCREATE database----;
After creating the database, view the database show databases;
Select the database you want to manipulate use---
View the tables in the database show tables;
1.2 Deleting a database
drop database----;
1.3 Creating a Table
CREATE TABLE---(name1 type constraint, name2 type constraint ...);
Look at the table you just created to see if it meets the requirements desc--;
1.4 Deleting a table
drop table----;
1.5 Modifying a table
To modify the data type of an item in a table ALTER TABLE---modify---;
Add new field ALTER TABLE---add colum----;
delete field ALTER TABLE---drop colum---;
Modify the field name ALTER TABLE---change---;
MySQL Base (DDL)