Understand the role of the database
Master concept base 、 surface 、 Record
The duration of this section needs to be controlled 15 Within minutes
With mysql This database software , The programmer can be freed from the management of data , Focus on programming logic
mysql The server software is mysqld Help us manage our files and folders , The premise is that we as users , Need to download mysql The client of , Or other modules to connect to mysqld, And then use mysql Submit your own commands in the syntax format specified by the software , Realize the management of folder or file . The syntax is sql(Structured Query Language Structured query language )
SQL Language is mainly used to access data 、 Query data 、 Updating data and managing relational database systems ,SQL Language by IBM Development .SQL Language is divided into 3 Types :
1、DDL sentence Database definition language : database 、 surface 、 View 、 Indexes 、 stored procedure , for example CREATE DROP ALTER
2、DML sentence Database manipulation language : insert data INSERT、 Delete data DELETE、 Update data UPDATE、 Query data SELECT
3、DCL sentence Database control language : For example, controlling user access GRANT、REVOKE
increase :create database db1 charset utf8;
check :show databases;
Change :alter database db1 charset latin1;
Delete : drop database db1;
Switch to the folder first :use db1
increase :create table t1(id int,name char);
check :show tables
Change :alter table t1 modify name char(3);
alter table t1 change name name1 char(2);
Delete :drop table t1;
increase :insert into t1 values(1,'egon1'),(2,'egon2'),(3,'egon3');
check :select * from t1;
Change :update t1 set name='sb' where id=2;
Delete :delete from t1 where id=1;