当前位置:网站首页>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 ....
边栏推荐
- word 退格键删除不了选中文本,只能按delete
- Preventing/catching “IllegalArgumentException: parameter must be a descendant of this view” error
- Hong Kong Polytechnic University | data efficient reinforcement learning and adaptive optimal perimeter control of network traffic dynamics
- Simulink oscilloscope data is imported into Matlab and drawn
- [Jianzhi offer] 57 - ii Continuous positive sequence with sum s
- There are several APIs of airtest and poco that are easy to use wrong in "super". See if you have encountered them
- QT串口ui设计和解决显示中文乱码
- NSQ source code installation and operation process
- 手机注册股票开户安全吗 开户需要钱吗
- 关于视觉SLAM的最先进技术的调查-A survey of state-of-the-art on visual SLAM
猜你喜欢

utfwry. Dat PHP, about ThinkPHP's method of IP location using utfwry address Library

消息队列消息丢失和消息重复发送的处理策略

为抵制 7-Zip,列出 “三宗罪” ?网友:“第3个才是重点吧?”

Mysql 将逗号隔开的属性字段数据由列转行

What material is sa537cl1? Sa537cl1 corresponds to the national standard material

2022.02.14_ Daily question leetcode five hundred and forty

What is the difference between 14Cr1MoR container plate and 14Cr1MoR (H)? Chemical composition and performance analysis of 14Cr1MoR

斑马识别成狗,AI犯错的原因被斯坦福找到了

2022 love analysis · panoramic report of digital manufacturers of state-owned enterprises
智慧之道(知行合一)
随机推荐
PHP CI (CodeIgniter) log level setting
【LeetCode】94. Middle order traversal of binary tree
13mnnimo5-4 German standard steel plate 13MnNiMo54 boiler steel 13MnNiMo54 chemical properties
What is the pledge pool and how to pledge?
What kind of material is 14Cr1MoR? Analysis of chemical composition and mechanical properties of 14Cr1MoR
Nifi from introduction to practice (nanny level tutorial) - flow
Arduino esp32: overall framework of lvgl project (I)
How to set up SVN server on this machine
PHP中register_globals参数设置
"The NTP socket is in use, exiting" appears when ntpdate synchronizes the time
[Jianzhi offer] 57 - ii Continuous positive sequence with sum s
What is the material of 13mnnimor? 13mnnimor steel plate for medium and low temperature pressure vessels
Netease UI automation test exploration: airtest+poco
Daily code 300 lines learning notes day 10
0214-27100 a day with little fluctuation
疫情常态化大背景下,关于远程办公的思考|社区征文
Add color to the interface automation test framework and realize the enterprise wechat test report
Data driving of appium framework for mobile terminal automated testing
utfwry. Dat PHP, about ThinkPHP's method of IP location using utfwry address Library
Explore Netease's large-scale automated testing solutions see here see here