当前位置:网站首页>Mysql database -dql
Mysql database -dql
2022-07-03 16:40:00 【Don't go to graduate school, don't change your name TL】
Single table query
Data preparation
-- establish db1 database
CREATE DATABASE db1;
-- Use db1 database
USE db1;
-- Create data table
CREATE TABLE product(
id INT, -- Product id
NAME VARCHAR(20), -- Name of commodity
price DOUBLE, -- commodity price
brand VARCHAR(10), -- Brand of goods
stock INT, -- inventory
insert_time DATE -- Add the time
);
-- Add data
INSERT INTO product VALUES (1,' Huawei mobile phones ',3999,' Huawei ',23,'2088-03-10'),
(2,' Mi phones ',2999,' millet ',30,'2088-05-15'),
(3,' Apple mobile phone ',5999,' Apple ',18,'2088-08-20'),
(4,' Huawei's computer ',6999,' Huawei ',14,'2088-06-16'),
(5,' Xiaomi computer ',4999,' millet ',26,'2088-07-08'),
(6,' Apple computer ',8999,' Apple ',15,'2088-10-25'),
(7,' Lenovo computer ',7999,' lenovo ',NULL,'2088-11-11');Created a db1 The database of , It contains product The table is shown below :

The query syntax
select
Field list
from
List of table names
where
List of conditions
group by
Grouping field
having
Grouping after Conditions ( Cannot use after grouping where, Only use having)
order by
Sort
limit
Paging limit
Query all
(1) Query data of all tables
(2) Query the table data of the specified field
(3) Remove duplicate queries
(4) Calculate the value of the column ( arithmetic )
(5) Alias query
unfinished ....
边栏推荐
- 拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。
- Data driving of appium framework for mobile terminal automated testing
- 数据分析必备的能力
- Basis of target detection (IOU)
- Thread pool executes scheduled tasks
- 线程池执行定时任务
- LeetCode1491. Average value of wages after removing the minimum wage and the maximum wage
- Détails du contrôle de la congestion TCP | 3. Espace de conception
- Visual SLAM algorithms: a survey from 2010 to 2016
- [combinatorics] polynomial theorem (polynomial coefficients | full arrangement of multiple sets | number of schemes corresponding to the ball sub model | polynomial coefficient correlation identity)
猜你喜欢

斑馬識別成狗,AI犯錯的原因被斯坦福找到了

2022.02.14_ Daily question leetcode five hundred and forty

深入理解 SQL 中的 Grouping Sets 语句

Thread pool executes scheduled tasks

What material is sa537cl2 equivalent to in China? Sa537cl2 corresponding material

What material is 13crmo4-5 equivalent to in China? 13crmo4-5 chemical composition 13crmo4-5 mechanical properties

2022爱分析· 国央企数字化厂商全景报告

A survey of state of the art on visual slam

Learn from me about the enterprise flutter project: simplified framework demo reference

Daily code 300 lines learning notes day 10
随机推荐
[combinatorics] summary of combinatorial identities (eleven combinatorial identities | proof methods of combinatorial identities | summation methods)*
Overview of satellite navigation system
拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。
Visual SLAM algorithms: a survey from 2010 to 2016
斑馬識別成狗,AI犯錯的原因被斯坦福找到了
arduino-esp32:LVGL项目(一)整体框架
"The NTP socket is in use, exiting" appears when ntpdate synchronizes the time
8 tips for effective performance evaluation
What material is 13crmo4-5 equivalent to in China? 13crmo4-5 chemical composition 13crmo4-5 mechanical properties
TCP擁塞控制詳解 | 3. 設計空間
【剑指 Offer】58 - I. 翻转单词顺序
NSQ source code installation and operation process
特征多项式与常系数齐次线性递推
【LeetCode】94. Middle order traversal of binary tree
Basis of target detection (IOU)
Caching mechanism of Hibernate / session level caching mechanism
Top k questions of interview
面试之 top k问题
JSON 与 BSON 区别
【剑指 Offer】58 - II. 左旋转字符串