当前位置:网站首页>MySQL Express - day 1 - basic introduction
MySQL Express - day 1 - basic introduction
2022-06-27 20:55:00 【Look at Qian!】
MySQL Fast track
( One )、MySQL First time to know
1.1、 Database introduction
Database introduction :
Database is organized according to data structure , Warehouse for storing and managing data . It is a collection of large amounts of organized, sharable and uniformly managed data stored in computers for a long time
1.2、 Classification of database :
1. Relational database (SQL) The relationship between tables
Oracle、MySQL、SQLSever
2. Non relational database (NoSQL:NOt Snly SQL) Data is stored in the database in the form of objects , Usually, the key value There is a form of
MongoDB、Redis
1.3、MySQL
1.3.1、MySQL brief introduction ( Fast operation )
. . MySQL Is a relational database management system , The Swedish MySQL AB Companies to develop , At present belongs to the Oracle company .MySQL It's an associated database management system , The associated database keeps the data in different tables , Instead of putting all the data in one big warehouse , This increases speed and flexibility .
1.3.2、MySQL Characteristics
- MySQL It's open source. , So you don't have to pay extra ;
- MySQL Support large databases . Can handle large databases with tens of millions of records ;
- MySQL standards-of-use SQL Data language form ;
- MySQL It can be installed on different operating systems , And provide the operation interface of multiple programming languages ;
- stay WEB Application aspect ,MySQL Have a good performance .
1.3.3、MySQL Interactive mode ( Server side : service + Storage engine )
MySQL Database is a kind of c/s( client / Server side ) Structured software , If you want to access the server, you must use the client ( The server has been running , The client runs when it needs to be used )
1、 Client connection authentication : Link server , Authentication
2、 The client sends SQL command
3、 Server receive SQL Instructions , Handle SQL Instructions 、 Return operation result
4、 The client receives the result , Show results .
1.3.4、 Database objects
From a macro point of view MySQL The internal objects of the server are divided into four layers : System (DBMS)-> database (DB)—> Data sheet (Tables)-> Field (fieid)
1.3.4.1、SQL Introduce
SQL(Structured Query Language) Structured query language , It is mainly divided into three parts :
1、DDL(Data Definition Language): Data definition language , Used to maintain the structure of stored data ( database 、 surface ). For instructions :
create、drop、alter etc. .
2、DML(Data Manipulation Language): Data operation language , It is mainly used to operate data ( What's in the data table ). For instructions :
insert、delete、update etc. .
3、 among DML There is a separate classification inside - DQL(Data Query Language) Data query language , Such as select. because 99% It's a query operation .
1.3.4.2、 Database basic command
Show the current mysql edition
SELECT VERSION();
Display the current system time
SELECT NOW();
Show current user
SELECT USER();
view the database
SHOW databases; --show( Show ) databases( database )
1.3.4.3、MySQL Grammatical norms
1、 Keywords and function names are all capitalized ( Lowercase can also be recognized , But lowercase is not good for distinguishing keywords from functions , So it is recommended to use upper case )
2、 Database name 、 Table name 、 Field names are all lowercase
3、SQL The statement must end with a semicolon
1.3.4.4、 Database operation command
1、 Create database ( No addition s)
CREATE DATABASE Database name ;
2、 view the database ( Add s)
SHOW DATABASES;
3、 Select the specified database
USE Database name ;
4、 Delete database
DROP DATAVABASE Database name ;
1.3.4.5、 Data table operation command ( library :database surface :table Field :column)
1、 Create table
CRETAE TABLE Table name ( Field , Field properties ,...);
# demonstration
create table User_Stu(ID int(10), name varchar(10), age int, sex varchar(10));
# perhaps
CRETAE TABLE USER(
ID INT(10),
NAME VARCHAR(10),
age INT,
sex VARCHAR(10) -- There is no comma
);
2、 View all tables
SHOW TABLES;
3、 View a single table
DESCRIPTION Table name ; It can be abbreviated desc + Table name
4、 Delete table
DROP TABLE Table name ;
drop table user1; -- Delete table user1
5、 Modify the name of the table
RENAME TABLE The old name of the table TO The new name of the table ;
ALTER TABLE RENAME The old name of the table TO The new name of the table ;
6、 Modify table type
ALTER TABLE The name of the table MODIFY Field Field definition ;
alter table user_stu modify name_ID varchar(10); -- user_stu Tabular name_ID The type changes to varchar(10);
7、 Modify fields
a、 newly added
ALTER TABLE The name of the table ADD COLUMN Field Field definition ;
alter table user_stu add modify name_ID int(10); --user_stu A new field is added to the table , Field called name_ID The type is int
b、 modify
ALTER TABLE The name of the table CHANGE Old fields The new fields Field definition ;
# change And MODIFY The difference between :change You can change the name , But it needs to be written twice
c、 Delete
ALTER TABLES The name of the table DROP COLUMN Field name ;
alter table user1 orop ID; -- Delete user1 Tabular id Column
边栏推荐
- Oracle architecture summary
- Database log
- Installation and configuration of grayog new generation log collection early warning system
- Univision hyperinsight: Nuggets' $16.494 billion "gold hoe" in the observable market?
- # Leetcode 821. Minimum distance of characters (simple)
- NVIDIA three piece environment configuration
- Grasp the detailed procedure of function call stack from instruction reading
- Practice of combining rook CEPH and rainbow, a cloud native storage solution
- 最佳实践:优化Postgres查询性能(下)
- 一段时间没用思源,升级到最新的 24 版后反复显示数据加密问题
猜你喜欢

Installation and configuration of grayog new generation log collection early warning system

【精品必读】Linux系统Oracle数据库趣解子查询

It took me 6 months to complete the excellent graduation project of undergraduate course. What have I done?

Csdn Skills Tree use Experience and Product Analysis (1)

Openharmony hisysevent dotting and calling practice of # Summer Challenge (L2)

众昂矿业:新能源或成萤石最大应用领域

BAIC makes a brand new pickup truck, which is safe and comfortable

Summary of redis big key problem handling

安全才是硬道理,沃尔沃XC40 RECHARGE

UOS prompts for password to unlock your login key ring solution
随机推荐
Pfsense plus22.01 Chinese customized version release
Database lock problem
Grasp the detailed procedure of function call stack from instruction reading
Univision hyperinsight: Nuggets' $16.494 billion "gold hoe" in the observable market?
UOS prompts for password to unlock your login key ring solution
BLE蓝牙模块NRF518/NRF281/NRF528/NRF284芯片方案对比
#夏日挑战赛# OpenHarmony HiSysEvent打点调用实践(L2)
# Leetcode 821. Minimum distance of characters (simple)
Postman 汉化教程(Postman中文版)
Logcli-loki 命令行工具
Oracle architecture summary
优维HyperInsight:掘金164.94亿美元可观测市场的“金锄头”?
众昂矿业:新能源或成萤石最大应用领域
Linux system Oracle 19C OEM monitoring management
【STL编程】【竞赛常用】【part 1】
shell脚本控制服务的启动和关闭 - 具备详细案例
[STL programming] [common competition] [Part 3]
低代码开发平台是什么?为什么现在那么火?
What is a low code development platform? Why is it so hot now?
爱数课实验 | 第七期-基于随机森林的金融危机分析