当前位置:网站首页>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
边栏推荐
- Yyds dry goods counting SQL sub query
- Character interception triplets of data warehouse: substrb, substr, substring
- CSDN skill tree experience and product analysis (1)
- Leetcode 989. Integer addition in array form (simple)
- Postman Chinese tutorial (postman Chinese version)
- What is a stack?
- 开启生态新姿势 | 使用 WrodPress 远程附件存储到 COS
- UOS prompts for password to unlock your login key ring solution
- When developing digital collections, how should cultural and Museum institutions grasp the scale of public welfare and Commerce? How to ensure the security of cultural relics data?
- 灵活的IP网络测试工具——— X-Launch
猜你喜欢

Character interception triplets of data warehouse: substrb, substr, substring

Sharing | intelligent environmental protection - ecological civilization informatization solution (PDF attached)

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

No wonder people chose apifox instead of postman

#夏日挑战赛# OpenHarmony HiSysEvent打点调用实践(L2)

On the drawing skills of my writing career

本周二晚19:00战码先锋第8期直播丨如何多方位参与OpenHarmony开源贡献

DBeaver恢复和备份数据库的方式

Database lock problem

It took me 6 months to complete the excellent graduation project of undergraduate course. What have I done?
随机推荐
安装NFS服务
pfSense Plus22.01中文定制版发布
eval函数,全局、本地变量
Database transactions
Record a failure caused by a custom redis distributed lock
抗洪救灾,共克时艰,城联优品驰援英德捐赠爱心物资
mime. Type file content
动物养殖生产虚拟仿真教学系统|华锐互动
使用MySqlBulkLoader批量插入数据
When developing digital collections, how should cultural and Museum institutions grasp the scale of public welfare and Commerce? How to ensure the security of cultural relics data?
安全高效,非接触“刷手”身份识别助力疫情防控
Unity3D Button根据文本内容自适应大小
Sharing | intelligent environmental protection - ecological civilization informatization solution (PDF attached)
Dictionary tree (review)
爱数课实验 | 第五期-基于机器学习方法的商品评论情感判定
1030 Travel Plan
Logcli-loki 命令行工具
Yyds dry goods counting SQL sub query
数仓的字符截取三胞胎:substrb、substr、substring
SQL审核平台权限模块介绍和账号创建教程