当前位置:网站首页>SQL statement learning
SQL statement learning
2022-07-19 05:02:00 【m0_ sixty-one million one hundred and sixty-nine thousand four 】
Catalog
WHERE
WHERE Clause to filter records ( Finally get the specified content )
Be careful :
SQL Use single quotes around the text value ( Most database systems also accept double quotes ).
In the previous example 'CN' The text field uses single quotation marks .
If it is a numeric field , Please don't use quotation marks .

LIKE Operator instance
LIKE The operator is used in WHERE Search for the specified pattern in the column .

NOT keyword

IN The operator

AND & OR Operator
AND Operator

OR Operator
Below SQL Statements from "Websites" The countries selected in the table are "USA" perhaps "CN" All of our customers

AND & OR
Below SQL Statements from "Websites" Select in the table alexa Ranking higher than "15" And the country is "CN" or "USA" All websites of

ORDER BY
ORDER BY By default, the keyword sorts the records in ascending order . If you need to sort records in descending order , You can use DESC keyword .
Below SQL Statements from "Websites" Select all sites in the table , And in accordance with the "alexa" Column sorting

Below SQL Statements from "Websites" Select all sites in the table , And in accordance with the "alexa" Sort columns in descending order

ORDER BY Multiple columns
SELECT * FROM Websites
ORDER BY country,alexa; SQL BETWEEN The operator
Below SQL Sentence selection alexa Be situated between 1 and 20 Between all websites
SELECT * FROM Websites
WHERE alexa BETWEEN 1 AND 20;Below SQL Sentence selection alexa Be situated between 1 and 20 But country Not for USA and IND All websites of
SELECT * FROM Websites
WHERE (alexa BETWEEN 1 AND 20)
AND country NOT IN ('USA', 'IND');SQL sentence
Mysql -uroot -p enter password # Get into mysql Commands for managing the command line
create database test1222; # Create database
show databases; # Display all current databases
drop database if exists test122202; # Delete database test122202, If the database exists
drop table table_name; # Delete a table ;
show tables; # Display all data tables in the current library ;
desc student; # Look at the data sheet student All fields in ;
alter table student add company varchar(50); # by student Add a field to the table ;
边栏推荐
猜你喜欢

Tasking new aurix tc37x demo project

ModerlArts第一次培训笔记

MYSQL两个查询条件取并集然后进行查询

浅聊全局过滤器

负载均衡器ribbon实战

One article to understand Zipkin

Some concepts of ES

Cve-2019-14234 Django jsonfield SQL injection vulnerability

SMS verification test without signature template audit

Implementation idea of log adding to database
随机推荐
微服务高并发服务治理
Cve-2019-14234 Django jsonfield SQL injection vulnerability
Message converter (JSON)
免签名模板审核的短信验证测试
redis 安装
NoSQL overview
thinkphp 官网教程
DSL搜索结果处理,包括排序,分页,高亮
Cve-2021-44228 log4j reproduction and principle
fastjson、jackjson、gson区别和注意点
FanoutExchange交换机简单使用
Encryption and decryption
DSL query document
Hyperlink implementation post submission
上传七牛云的方法
Flask的使用
OLTP Load Performance Optimization Practice
Implementation idea of log adding to database
Fanoutexchange switch is simple to use
RestAPI