当前位置:网站首页>Day-27 database
Day-27 database
2022-07-03 18:35:00 【Xiaobai shelter】
First knowledge of database : Additions and deletions Example
Create a xiaoming user , Let Xiao Ming have the maximum authority ( and root equally )CREATE USER ‘username’@‘host’ IDENTIFIED BY ‘password’;
create user 'xiaoming'@'localhost'IDENTIFIED by '123';
Delete xiaoming user drop user user name @’%’;
drop user [email protected]'localhost';
# establish test database create database Database name
create database test;
# Delete test database
drop database test;
# establish Student list (student)
# Table has
id int
name varchar(30)
create table student(
id int,
name VARCHAR(30)
)
# Delete student surface
drop table student;
# Create a test_01 database , And create test_01 surface
Table has id , name , phone Please make rational use of data types
Add data to the table insert into Table name ( Name 1, Name 2) values ( value 1, value 2);
1 Zhang San 13113113111
# 2 Li Si 13213213222
# 3 Wang Wu 13313313333
hold id by 2 Of Phone changed to 13413413444
Delete id by 3 The record of
Query all remaining records
Delete test_01 Tables and databases
create database test_01;
create table test_0111123(
id int,
name VARCHAR(255),
phone CHAR(11)
)
INSERT into test_0111123 (id,name,phone) VALUES(1,' Zhang San ','13113113111');
INSERT into test_0111123 (id,name,phone) VALUES(2,' Li Si ','13113113222');
INSERT into test_0111123 (id,name,phone) VALUES(3,' Wang Wu ','13113113333');
#update Table name set Name 1= value , Name 2= value where Name = value ;
update test_0111123 set phone='13413413444' where id=2;
#delete from Table name where Name = value ;
delete from test_0111123 where id=3;
select * from test_0111123;
DROP table test_01;
DROP DATABASE test_01;
# Sign in test01 user , stay test_01 Create... Under database t_student surface , Table has id,name,sex,course,score
# among id yes int
name yes varchar
# sex yes char
# course yes varchar
# score yes decimal
towards t_student Insert in table 3 Data
1 Zhang San male javaSE 99
# 2 Li Si Woman javaWEB 98
3 Wang Wu male javEE 99.5
# stay test_01 Create... Under database t_student surface , Table has id,name,sex,course,score
use test_01;
create table t_student(
id int,
name VARCHAR(255),
sex VARCHAR(255),
course VARCHAR(255),
score DECIMAL(5,2)
)
drop table t_student;
# insert data
#insert into Table name ( Name 1, Name 2) values ( value 1, value 2);
insert into t_student(id,name,sex,course,score) VALUES(1,' Zhang San ',' male ','javaSE',99);
insert into t_student(id,name,sex,course,score) VALUES(2,' Li Si ',' Woman ','javaWEB',98);
insert into t_student(id,name,sex,course,score) VALUES(3,' Wang Wu ',' male ','javaEE',99.5);
# hold course by javaEE The scores of Change to 100 grammar :update Table name set Name 1= value , Name 2= value where Name = value ;
update t_student set score=100 where course='javaEE';
# hold Zhang San's gender is changed to Woman
update t_student set sex=‘ Woman ’ where name=‘ Zhang San ’;
# hold Wang Wu delete grammar : delete from Table name where Name = value ;
delete from t_student where name=‘ Wang Wu ’;
# hold t_student Table delete
drop table t_student;
# hold test_01 Database delete
drop database test_01;
# hold test01 User deletion ( Sign in root user ) drop user user name @’%’;
drop user [email protected]‘localhost’;
FLUSH PRIVILEGES;
边栏推荐
- Summary and Reflection on the third week of winter vacation
- How to quickly view the inheritance methods of existing models in torchvision?
- Torch learning notes (7) -- take lenet as an example for dataload operation (detailed explanation + reserve knowledge supplement)
- Analysis of the reasons why enterprises build their own software development teams to use software manpower outsourcing services at the same time
- Boost. Asio Library
- Self executing function
- MySQL duplicate check
- How do microservices aggregate API documents? This wave of operation is too good
- [Yu Yue education] world reference materials of Microbiology in Shanghai Jiaotong University
- English语法_名词 - 分类
猜你喜欢

Caddy server agent

Sensor 调试流程

Mysql45 lecture learning notes (II)

How to quickly view the inheritance methods of existing models in torchvision?

Kratos微服务框架下实现CQRS架构模式

Three gradient descent methods and code implementation

Bidding procurement scheme management of Oracle project management system

Opencv learning notes (continuously updated)

2022-2028 global marking ink industry research and trend analysis report

How to analyze the rising and falling rules of London gold trend chart
随机推荐
[combinatorics] generating function (use generating function to solve the combination number of multiple sets R)
NFT new opportunity, multimedia NFT aggregation platform okaleido will be launched soon
Typescript official website tutorial
Golang string (string) and byte array ([]byte) are converted to each other
Count the number of pixel values in the image
Gao Qing, Beijing University of Aeronautics and Astronautics: CIM is a natural quantum computing platform for graph data processing
199. Right view of binary tree - breadth search
English grammar_ Noun classification
MySQL duplicate check
English grammar_ Adjective / adverb Level 3 - multiple expression
Solve the problem of inaccurate network traffic monitored by ZABBIX with SNMP
SQL injection -day16
Win32: dump file analysis of heap corruption
[linux]centos 7 reports an error when installing MySQL "no package MySQL server available" no package ZABBIX server MySQL available
ES7 - Optimization of promise
[combinatorics] generating function (generating function application scenario | using generating function to solve recursive equation)
JS_ Array_ sort
How to draw non overlapping bubble chart in MATLAB
[Yu Yue education] world reference materials of Microbiology in Shanghai Jiaotong University
多媒体NFT聚合平台OKALEIDO即将上线,全新的NFT时代或将来临