当前位置:网站首页>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
边栏推荐
猜你喜欢
JVM 内存模型
405 method not allowed appears when the third party jumps to the website
鼠标右键 自定义
Instructions for using the domain analysis tool bloodhound
Baidu flying general BMN timing action positioning framework | data preparation and training guide (Part 2)
AI 从代码中自动生成注释文档
Gin introduction practice
Yunna | work order management software, work order management software app
AcWing 345. 牛站 题解(floyd的性质、倍增)
修改px4飞控的系统时间
随机推荐
Make Jar, Not War
AcWing 1142. 繁忙的都市 题解(最小生成树)
Google released a security update to fix 0 days that have been used in chrome
从底层结构开始学习FPGA----FIFO IP的定制与测试
机器学习:随机梯度下降(SGD)与梯度下降(GD)的区别与代码实现。
一文带你走进【内存泄漏】
Add PDF Title floating window
C language instance_ two
Telnet,SSH1,SSH2,Telnet/SSL,Rlogin,Serial,TAPI,RAW
WCF基金会
Ds-5/rvds4.0 variable initialization error
百度飞将BMN时序动作定位框架 | 数据准备与训练指南 (上)
454 Baidu Mianjing 1
AcWing 1141. LAN problem solving (kruskalkruskal finding the minimum spanning tree)
JVM 内存模型
C语言实例_3
405 method not allowed appears when the third party jumps to the website
ZOJ Problem Set – 2563 Long Dominoes 【如压力dp】
Blue Bridge Cup 2022 13th provincial competition real topic - block painting
JS how to quickly create an array with length n