The database is a special file that is stored on the hard disk
relational database core element
mysql columns record called a field line as a
column ---> field
lines ---> Record
Data table (set of data lines)
database (a collection of data tables)
If you can mark one of the only fields: So this is the primary key.
mysql (do site, persistent data storage
mongbd (non-relational data store for storing crawler)
redis (cache)
关系型数据库
oracle
mysql (web时代使用最广泛的关系型数据库)
sql server
sqlite :轻量级数据库 主要应用在移动平台上。
SQL is structured query language
DQL:数据查询语言,用于对数据进行查询,如select
DML:数据操作语言,用于对数据进行增加、修改、删除。如insert update delete
TPL:事务处理语言,对事务进行处理,包括begin transaction commit rollback
DCL: 数据控制语言,进行授权和权限回收,如grant revoke
DDL: 数据定义语言,进行数据库、表的管理等
CCL: 指针控制语言,通过控制指针完成表的操作,如declare curs
对于web程序员来讲,重点是数据的crud(增删改查)必须熟练编写DQL DML 能够编写DDL完成数据库、表的操作,其他语言如TPL、DCL CCL了解即可
SQL是一门特殊的语言,专门用来操作关系型数据库(不区分大小写)
Log mysql client == ==
查看版本:select version()
/*学习sql语句进行操作*/
Data types, constraints
decimal
For pictures, audio, video and other files are not stored in the database, but uploaded to a server, and storage save path of the file in the table. (Seven cattle storing audio video pictures)
Type -> Match
外键:某个表的字段是另一个表的主键。 作用:具有约束
Command line operations database
mysql -uroot -p - Log Database
exit / quit / ctrl + d - the number of exit
show databases; - View all databases are case-insensitive
-; The semicolon indicates the end of a sql statement.
select now (); - Displays the current database time
select version (); - Displays the current version
create database database name of the charset = utf8 - create the database, specify the encoding format to utf8
show create database database name; - check the database name
drop database database name; - delete the database
use database name; - use the database to create a table
select database (); - view the current database used