当前位置:网站首页>MySQL beginner benefits
MySQL beginner benefits
2022-06-27 19:50:00 【The past days were like the wind_】

List of articles
1、 Database related operations
1.1、 Display database
Code :show database;
show and databases There is a space between , It can be multiple , But don't omit in addition SQL Case insensitive
Examples of operation :
1.2、 Create database
Format :create database Database name ;
The name of the database can be used casually But it can't be SQL Keywords in If you really want to use Just enclose it in reverse quotation marks The counter quotation marks are in Esc below Tab above
Examples of operation :
1.3、 Select database
Format :use Database name ;
Before proceeding further with the database , You need to select the database first , Do it again
Example operation :
1.4、 Delete database
Format :drop database Database name :
Delete the database Use with caution !!! “ Delete library from , To run ”
Code example :
1.5、 stay cmd Run in MySQL
Input :mysql -u root -p password
Code example ;
Try entering the above command :
show database;
create database Database name ;
use Database name ;
drop database Database name :
Code example :
2、 Data sheet
There can be many data tables in a database
Each data table can have many rows , Each line becomes a " Record "
Each row can have many columns , Each column is called a " Field "
MySQL Such a database The columns in each row are consistent
Suppose the first row has three columns So each row has three columns 
2.1、 Create table
Select the database to be operated before operation
use student;
When specifying columns , List first , Type after Format :create table Table name ( Name type , Name type …);
Code example :
When the library name to be operated is not specified could not be built
Code example :
2.2、 See the table
Format :show tables;
The above selected database ;
Code example :
Code :show tables;
Running results :
±------------------+
| Tables_in_student |
±------------------+
| student |
±------------------+
1 row in set (0.00 sec)
2.3、 View table structure
See how many columns there are in a table , What type is each column , What is the name of each column and other supplementary information for each column
grid
type :desc Table name ; desc<===>describe— describe
Code example :
Field----> Field Null among :
Yes Indicates that this column is allowed to be empty
No Indicates that this column cannot be empty
Default—> The default value is
In the middle of Null The delegate field is empty by default
Extra–> Additional information
2.4、 practice
There is a store data , Record customers and shopping , It consists of the following three tables :
goods goods( Product id goods_id, Trade name goods_name, The unit price unitprice, Commodity categories category, for
Ying Shang provider)
Customer customer( Customer number customer_id, full name name, address address, mailbox email, Gender sex, Id card
card_id)
Buy purchase( Purchase order No order_id, Customer number customer_id, Commodity number goods_id, Purchase quantity nums)
Process description :
Create database

Select database

Create database tables
goods 
Customer 
Buy 
Examples of operation :


边栏推荐
- Minmei new energy rushes to Shenzhen Stock Exchange: the annual accounts receivable exceeds 600million and the proposed fund-raising is 450million
- 【云驻共创】 什么是信息化?什么是数字化?这两者有什么联系和区别?
- shell脚本常用命令(四)
- Informatics Orsay all in one 1335: [example 2-4] connected block
- binder hwbinder vndbinder
- binder hwbinder vndbinder
- Four years of College for an ordinary graduate
- 新中大冲刺科创板:年营收2.84亿 拟募资5.57亿
- Workflow automation low code is the key
- Doctoral Dissertation of the University of Toronto - training efficiency and robustness in deep learning
猜你喜欢

Bit.Store:熊市漫漫,稳定Staking产品或成主旋律

今晚战码先锋润和赛道第2期直播丨如何参与OpenHarmony代码贡献

Doctoral Dissertation of the University of Toronto - training efficiency and robustness in deep learning

Jinyuan's high-end IPO was terminated: it was planned to raise 750million Rushan assets and Liyang industrial investment were shareholders

基于STM32F103ZET6库函数外部中断实验

Redis 原理 - String

What is ICMP? What is the relationship between Ping and ICMP?

海底电缆探测技术总结

新中大冲刺科创板:年营收2.84亿 拟募资5.57亿

SQL Server - Window Function - 解决连续N条记录过滤问题
随机推荐
Photoshop-图层相关概念-LayerComp-Layers-移动旋转复制图层-复合图层
Cdga | what is the core of digital transformation in the transportation industry?
Making single test so simple -- initial experience of Spock framework
Determine whether a variable is an array or an object?
Hanoi塔问题
经纬度分析
在线文本按行批量反转工具
【云驻共创】 什么是信息化?什么是数字化?这两者有什么联系和区别?
Is it safe to buy stocks and open an account on the account opening link of the securities manager? Ask the great God for help
Vs code runs "yarn run dev" and reports "yarn": the file XXX cannot be loaded
Informatics Orsay all in one 1335: [example 2-4] connected block
Seven phases of CMS implementation
如何封装调用一个库
External interrupt experiment based on stm32f103zet6 library function
Bit.Store:熊市漫漫,稳定Staking产品或成主旋律
你知道 log4j2 各项配置的全部含义吗?带你了解 log4j2 的全部组件
Tupu digital twin intelligent energy integrated management and control platform
labelimg使用指南
惊呆!原来 markdown 的画图功能如此强大!
实战回忆录:从Webshell开始突破边界