当前位置:网站首页>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
边栏推荐
猜你喜欢

难怪大家丢掉了postman而选择 Apifox

Pfsense plus22.01 Chinese customized version release

UE4: explanation of build configuration and config

北汽制造全新皮卡曝光,安全、舒适一个不落
I haven't thought about the source for some time. After upgrading to the latest version 24, the data encryption problem is repeatedly displayed

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

Select auto increment or sequence for primary key selection?

Postman 汉化教程(Postman中文版)

【STL编程】【竞赛常用】【part 1】

OpenSSL client programming: SSL session failure caused by an obscure function
随机推荐
在开发数字藏品时,文博机构该如何把握公益和商业的尺度?如何确保文物数据的安全?
UE4 essays: fstring, fname and ftext
探秘GaussDB,听听客户和伙伴怎么说
CSDN 技能树使用体验与产品分析(1)
shell脚本控制服务的启动和关闭 - 具备详细案例
海量数据出席兰州openGauss Meetup(生态全国行)活动,以企业级数据库赋能用户应用升级
DBeaver恢复和备份数据库的方式
UOS提示输入密码以解锁您的登陆密钥环解决办法
Web APLS phase - Section 14 - local storage
1029 Median
UE4: explanation of build configuration and config
Database index
基于微信小程序的高校毕业论文管理系统#毕业设计
Dictionary tree (review)
Linux系统ORACLE 19C OEM监控管理
众昂矿业:新能源或成萤石最大应用领域
pfSense Plus22.01中文定制版发布
[array]bm99 clockwise rotation matrix - simple
大促场景下,如何做好网关高可用防护
Grasp the detailed procedure of function call stack from instruction reading