当前位置:网站首页>MySQL's most basic select statement
MySQL's most basic select statement
2022-07-07 01:44:00 【Hu Yangyang y】
1. Basic statement
(1) View all databases
show databases;
(2) Create your own database
create database Database name
(3) Use your own database
use Database name
(4) View all tables in a library
show tables from Database name
(5) Create a new table
create table The name of the table ( Field name data type ,
Field name data type );
explain : If it is the last field , Then add a comma , Because the comma is used to separate each field .
(6) View the data of a table
select * from Database table name ;
(7) Add a record
insert into The name of the table values( List of values );
(8) View the table creation information
show tables;
(9) View database creation information
show create database Database name \G
(10) Delete table
drop table The name of the table ;
(11) Delete database
drop database Database name
(12) Import an existing data table , The data table
One .source The full pathname of the file
explain : Can only be used at the command prompt
Two . Tools based on specific graphical interfaces can import data
explain : I'm using SQLyog,Windows The system is case insensitive
however SQLyog Keyword functions in are capitalized , So the following statements will be capitalized
2. The most basic SELECT sentence
(1)SELECT Field 1, Field 2,.....FROM Table name ;
dual: false ( false ) surface *: All fields in the table ( Or column )
(2) Full name of the column
as: Full name (alias( Alias )), It can be omitted
Column aliases can use a pair of " " Lead up , Do not use ' '
(3) Remove duplicate lines
SELECT DISTINCT Field FROM Table name ;
(4) Null values participate in the operation
Null value :null
null Not equal to 0,' ','null'
Null values participate in the operation : The result must also be empty
Solutions to practical problems : introduce IFNULL
(5) mark of emphasis
SELECT * EROM 'order';// Same name as keyword
(6) Query constant
Columns such as :SELECT 'huyangyang',123,emplovee_id,last_name
FROM employees;
(7) Display table structure
DESCRIBE Table name ;
Shows the details of the fields in the table
or DESC
(8) Filtering data
SELECT * FROM Table name WHERE Field = 'huyangyang';
The query field is 'huyangyang' Employee information
边栏推荐
- 各种语言,软件,系统的国内镜像,收藏这一个仓库就够了: Thanks-Mirror
- 一起看看matlab工具箱内部是如何实现BP神经网络的
- 盒子拉伸拉扯(左右模式)
- LeetCode. 剑指offer 62. 圆圈中最后剩下的数
- Taro2.* applet configuration sharing wechat circle of friends
- According to the analysis of the Internet industry in 2022, how to choose a suitable position?
- Ds-5/rvds4.0 variable initialization error
- AcWing 1148. 秘密的牛奶运输 题解(最小生成树)
- Baidu flying general BMN timing action positioning framework | data preparation and training guide (Part 2)
- WCF基金会
猜你喜欢
【C语言进阶篇】指针的8道笔试题
AcWing 361. Sightseeing cow problem solution (SPFA seeking positive ring)
[advanced C language] 8 written questions of pointer
Typical problems of subnet division and super network construction
移植DAC芯片MCP4725驱动到NUC980
tansig和logsig的差异,为什么BP喜欢用tansig
454 Baidu Mianjing 1
Today's question -2022/7/4 modify string reference type variables in lambda body
Appium自动化测试基础 — uiautomatorviewer定位工具
1123. 最深叶节点的最近公共祖先
随机推荐
JS how to quickly create an array with length n
C language instance_ two
移植DAC芯片MCP4725驱动到NUC980
Telnet,SSH1,SSH2,Telnet/SSL,Rlogin,Serial,TAPI,RAW
【C语言进阶篇】指针的8道笔试题
黑马笔记---异常处理
js如何快速创建一个长度为 n 的数组
mongodb查看表是否导入成功
curl 命令
swiper组件中使用video导致全屏错位
AcWing 1142. Busy urban problem solving (minimum spanning tree)
What does front-end processor mean? What is the main function? What is the difference with fortress machine?
数据手册中的词汇
AcWing 1148. Secret milk transportation problem solution (minimum spanning tree)
AcWing 1141. 局域网 题解(kruskalkruskal 求最小生成树)
Make Jar, Not War
一文带你走进【内存泄漏】
JS reverse -- ob confusion and accelerated music that poked the [hornet's nest]
AcWing 361. 观光奶牛 题解(spfa求正环)
First experience of JSON learning - the third-party jar package realizes bean, list and map to create JSON format