当前位置:网站首页>Day 6 summary & database operation
Day 6 summary & database operation
2022-07-26 08:52:00 【xbxbgk】
1. Classification of database
Relational type :mysql,oracle,sqllite( The mobile terminal comes with ,django Default ),sql server
Non relational :redis,mongoDB
2.mysql install
Guarantee : Check whether the computer has been installed before installation , uninstall mysql5.5 edition ,django Use 5.5 above
A database is used to store data
library / surface Library similar directory The table is similar to the table of contents excle
3. Basic knowledge
sql sentence
Dedicated to manipulating libraries and tables a key
sql The classification of sentences
Database query language (DQL) select
Database operation language (DML) delete update insert
Database definition language (DDL) establish 、 Delete 、 Modify the structure of the table create、drop、alter
Field type
Integers :int/bigint
decimal :float/double
character string :char/varchar
Time :date/time/datetime
Field constraints
null Can be null
not null Can't be empty
default The default value is
primary key Primary key
auto_increment Self increasing
charset Set character set
4.DDL Database definition language
Create a library
create database Library name CHARSET=utf8;
Delete Library
DROP DATABASE Library name ;
The statement to query the created library
show create DATABASE Library name ;
Use the library
use Library name
Create table
create table Table name ( Field type length , Field type length )
Delete table
drop table Table name
Query the statement that creates the table
show create table Table name ;
The structure of the query table
desc Table name
Modify table structure
newly added :alter table Table name add Field name type length ;
modify :alter table Table name MODIFY COLUMN Field name type length ;
Delete : alter table Table name drop Field name ;
5.DML Database operation language
newly added
insert into Table name value ( value , value , value , value ), ( value , value , value , value )
modify
UPDATE Table name set Field = The new value where Conditions Modify the data of a field
UPDATE Table name set Field = The new value , Field = The new value where Conditions Modify the data of two fields
Delete
delete from Table name where Conditions Delete specified data
delete from Table name Delete all data
6.DQL Database query language
Query all the data :select * from Table name ;
Query the data of the specified field :select Field name , Field name from Table name ;
Comparison operator : > >= < <=
select * from Table name where Field > value ;
Logical operators :and or not
SELECT * from student where sex=' Woman ' and score>92
SELECT * from student where sex=' Woman ' or score>92
SELECT * from student where sex=' male '
SELECT * from student where not sex=' Woman '
keyword -- Fuzzy query
select * from Table name where Field like '% Fuzzy data %'
eg:%: Match all data _: To match a character
Range queries 80~95
stay ... Between stay .... in
SELECT * from student where score BETWEEN 80 and 95;
SELECT * from student where id in(1,3,5,7)
Sort
select * from Table name order by Field desc( In reverse order ), Field desc( In reverse order )
grouping
function :count() Query quantity sum() and max() The lion min() Take the minimum avg() The average
select count(*) from Table name group by Field having Conditions
eg:having similar where But in general where It cannot be used with functions later ,having Can often and group by Use it together
Pagination
limit Start index position , The number of bars displayed
SELECT * from student LIMIT 0,3
Homework 1

Homework 2

Homework 6

Homework 7

Additions and deletions

边栏推荐
- Excel delete blank lines
- Typescript snowflake primary key generator
- KV database based on raft consensus protocol
- 海内外媒体宣发自媒体发稿要严格把握内容关
- Oracle 19C OCP 1z0-082 certification examination question bank (19-23)
- 数据库操作技能7
- Foundry教程:使用多种方式编写可升级的智能合约(上)
- MySQL 8.0 OCP (1z0-908) has a Chinese exam
- day06 作业--技能题6
- keepalived双机热备
猜你喜欢

In the first year of L2, the upgrade of arbitrum nitro brought a more compatible and efficient development experience

合工大苍穹战队视觉组培训Day6——传统视觉,图像处理

Excel delete blank lines

Transfer guide printing system based on C language design
![[untitled]](/img/89/c3ab79eb325f0136114a568745924b.png)
[untitled]

6、 Pinda general permission system__ pd-tools-log

C Entry series (31) -- operator overloading

03异常处理,状态保持,请求钩子---04大型项目结构与蓝图

Kotlin properties and fields

SSH,NFS,FTP
随机推荐
Typescript snowflake primary key generator
Replication of SQL injection vulnerability in the foreground of Pan micro e-cology8
Mysql/mariadb (Galera multi master mode) cluster construction
Winter vacation homework & Stamp cutting
node-v下载与应用、ES6模块导入与导出
Oracle 19C OCP certification examination software list
Study notes of automatic control principle --- stability analysis of control system
2022年收益率最高的理财产品是哪个?
[encryption weekly] has the encryption market recovered? The cold winter still hasn't thawed out. Take stock of the major events that occurred in the encryption market last week
CSDN TOP1“一个处女座的程序猿“如何通过写作成为百万粉丝博主?
2000年的教训。web3是否=第三次工业革命?
Deploy prometheus+grafana monitoring platform
keepalived双机热备
六、品达通用权限系统__pd-tools-log
Foundry教程:使用多种方式编写可升级的智能合约(上)
[recommended collection] MySQL 30000 word essence summary - query and transaction (III)
Self review ideas of probability theory
基于C#实现的文件管理文件系统
Uni app simple mall production
Mycat2 sub database and sub table