当前位置:网站首页>Database notes sorting
Database notes sorting
2022-07-27 16:48:00 【.Null】
Summary of knowledge points :
database :
effect ( comparison excel):
Security ( For servers ):
Reading and writing 、 Query power ( efficiency ):
MySQL:Concept : Relational database ( One or more tables ).
Header (header)、 That's ok (row)、 Column (col)、 value (value)、 key (key);data type :
Numeric type :( Integer and floating point )
Date and time :(data、time、datatime etc. )
String type :( character string 、 Text and binary, etc )keyword :(NULL、NOT NULL、DEFAULT etc. )
Using a database :
1) Log in to MySQL:
2) Create a database :create databases Database name ; -> show databases;
3) Select the database you want to operate on :use Database name ;
4) Create database tables :create table The name of the table ( List of statements );
5) Delete database tables :drop database Database name ;Operating the database ( And SQL The same ):
1) Insert data into table :insert into Table name values();
2) Query data in table :select Name from Table name [ Query criteria ];
Select * from Table name ;
DISTINCT keyword : Take an unrepeatable ;
Like/Not like
3) Query by specific conditions :select * from Table name where Conditions ;((where name like “% king %”))
4) Update the data in the table :update Table name set Column name = The new value where Update conditions ;
5) Delete data from table :delete from Table name where Delete the condition ;
summary : increase (insert into…values…)、 Delete (delete from…where…)、 Change (update…set…where…)、 check (select * from…where…).
SortModification after table creation :alter table …change/add/drop/rename/
Add columns 、 Modify the column 、 Delete column 、 rename table 、 Delete the entire table 、 Delete the entire database :
SQL Advanced :
1)like: 2)In: 3)Between: 4) link :inner join、left join、right join、full join 5)SQL function :
Aggregate function ( Clustering function ):avg()/count()/first()/last()/min()/sum()
Scalar function ( Scalar function ):ucase() Capitalization /lcase() A lowercase letter /mid() Extract characters /substring(1,end)/len()/round() rounding /now( Japan period )/format() format
Database tools : MySQL WorkBench
Create database -> Create table -> In the data -> Reading data ( operation )
10、 explain : A few simple basic sql sentence
choice :select * from table1 where Range
Insert :insert into table1(field1,field2) values(value1,value2)
Delete :delete from table1 where Range
to update :update table1 set field1=value1 where Range
lookup :select * from table1 where field1 like ’%value1%’ —like The grammar of is very exquisite , Check information !
Sort :select * from table1 order by field1,field2 [desc]
total :select count as totalcount from table1
Sum up :select sum(field1) as sumvalue from table1
Average :select avg(field1) as avgvalue from table1
Maximum :select max(field1) as maxvalue from table1
Minimum :select min(field1) as minvalue from table1
from( surface )+ Link query
Link query
• Internal connection :Inner join
• Left connection :Left join
• The right connection :Right join
Find out the common information of these two tables by inline (as Is the alias of the table , convenient ).
The left outer join : All the values in the left table will be displayed , The values in the right table show on Results of conditional search , Cannot search for NULL.
The right outer connection is opposite to the left outer connection ( The values in the right table are all displayed ).
边栏推荐
猜你喜欢
随机推荐
The class declared by the scala object keyword directly calls methods and associated objects
solidwork装配体导入到Adams中出现多个Part重名和Part丢失的情况处理
Chat skills
Log management
MySQL—连表查询
Great Cells & Counting Grids
Bean: Model: Entity的区别
从零开始Blazor Server(1)--项目搭建
word中插入度的方法
The 31st --- the 52nd
CCF-201312-1
Supplement - example of integer programming
Four solutions of maximum sub segment and go
Filament Creator材质编辑工具的实现
The difference between MVC and MVP and MVVM
[cqoi2012] local minima & Mike and foam
【pytorch】|transforms.FiveCrop
Gpt-2 text generation
Opencv (IV) -- image features and target detection
Insert pictures in word to maintain high DPI method









