当前位置:网站首页>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 ....
边栏推荐
- 中南大学|通过探索理解: 发现具有深度强化学习的可解释特征
- Nifi from introduction to practice (nanny level tutorial) - flow
- 8 cool visual charts to quickly write the visual analysis report that the boss likes to see
- Hibernate的缓存机制/会话级缓存机制
- 【剑指 Offer】58 - II. 左旋转字符串
- NLP四范式:范式一:非神经网络时代的完全监督学习(特征工程);范式二:基于神经网络的完全监督学习(架构工程);范式三:预训练,精调范式(目标工程);范式四:预训练,提示,预测范式(Prompt工程)
- 13mnnimo5-4 German standard steel plate 13MnNiMo54 boiler steel 13MnNiMo54 chemical properties
- [Jianzhi offer] 58 - ii Rotate string left
- Basis of target detection (IOU)
- Extraction of the same pointcut
猜你喜欢
[combinatorics] non descending path problem (outline of non descending path problem | basic model of non descending path problem | non descending path problem expansion model 1 non origin starting poi
What material is 13crmo4-5 equivalent to in China? 13crmo4-5 chemical composition 13crmo4-5 mechanical properties
TCP congestion control details | 3 design space
[statement] about searching sogk1997 and finding many web crawler results
Mysql 单表字段重复数据取最新一条sql语句
于文文、胡夏等明星带你玩转派对 皮皮APP点燃你的夏日
What kind of material is 14Cr1MoR? Analysis of chemical composition and mechanical properties of 14Cr1MoR
[combinatorics] non descending path problem (number of non descending paths with constraints)
Visual SLAM algorithms: a survey from 2010 to 2016
线程池执行定时任务
随机推荐
What is the material of sa302grc? American standard container plate sa302grc chemical composition
线程池执行定时任务
利用MySQL中的乐观锁和悲观锁实现分布式锁
How programming apes grow rapidly
Leetcode binary search tree
Nifi from introduction to practice (nanny level tutorial) - flow
探索Cassandra的去中心化分布式架构
What kind of material is 14Cr1MoR? Analysis of chemical composition and mechanical properties of 14Cr1MoR
Interpretation of several important concepts of satellite antenna
Arduino esp32: overall framework of lvgl project (I)
Unreal_ Datatable implements ID self increment and sets rowname
1287. Elements that appear more than 25% in an ordered array
【剑指 Offer 】64. 求1+2+…+n
JSON 与 BSON 区别
Mysql 单表字段重复数据取最新一条sql语句
What material is sa537cl2 equivalent to in China? Sa537cl2 corresponding material
于文文、胡夏等明星带你玩转派对 皮皮APP点燃你的夏日
跟我学企业级flutter项目:简化框架demo参考
Difference between JSON and bson
Shentong express expects an annual loss of nearly 1billion