当前位置:网站首页>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 ....
边栏推荐
- 1287. Elements that appear more than 25% in an ordered array
- 智慧之道(知行合一)
- 8个酷炫可视化图表,快速写出老板爱看的可视化分析报告
- Alibaba P8 painstakingly sorted it out. Summary of APP UI automated testing ideas. Check it out
- Leetcode binary search tree
- [Jianzhi offer] 58 - ii Rotate string left
- 跟我学企业级flutter项目:简化框架demo参考
- 面试官:JVM如何分配和回收堆外内存
- Unity项目优化案例一
- 面试之 top k问题
猜你喜欢

What kind of material is 14Cr1MoR? Analysis of chemical composition and mechanical properties of 14Cr1MoR

There are several APIs of airtest and poco that are easy to use wrong in "super". See if you have encountered them

(Supplement) double pointer topic

Explore Netease's large-scale automated testing solutions see here see here

Cocos Creator 2. X automatic packaging (build + compile)

Unreal_DataTable 实现Id自增与设置RowName

NSQ source code installation and operation process

面试官:JVM如何分配和回收堆外内存

arduino-esp32:LVGL项目(一)整体框架

【LeetCode】94. Middle order traversal of binary tree
随机推荐
Shentong express expects an annual loss of nearly 1billion
Custom plug-in construction and use of QT plug-in
Nifi from introduction to practice (nanny level tutorial) - flow
JSON 与 BSON 区别
function overloading
Golang 装饰器模式以及在NSQ中的使用
Page dynamics [2]keyframes
一台服务器最大并发 tcp 连接数多少?65535?
拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。
arduino-esp32:LVGL项目(一)整体框架
远程办公之大家一同实现合作编辑资料和开发文档 | 社区征文
SVN使用规范
Golang anonymous function use
0214-27100 a day with little fluctuation
Multithread 02 thread join
TCP擁塞控制詳解 | 3. 設計空間
PHP二级域名session共享方案
疫情常态化大背景下,关于远程办公的思考|社区征文
Zebras are recognized as dogs, and Stanford found the reason why AI made mistakes
What material is 12cr1movr? Chemical property analysis of pressure vessel steel plate 12cr1movr