当前位置:网站首页>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;
边栏推荐
- What London Silver Trading software supports multiple languages
- Valentine's day, send you a little red flower~
- A. Odd Selection【BruteForce】
- Gao Qing, Beijing University of Aeronautics and Astronautics: CIM is a natural quantum computing platform for graph data processing
- ES7 - Optimization of promise
- Niuke monthly race 31 minus integer
- 2022-2028 global scar care product industry research and trend analysis report
- How to disable the clear button of ie10 insert text box- How can I disable the clear button that IE10 inserts into textboxes?
- Multifunctional web file manager filestash
- [combinatorics] exponential generating function (proving that the exponential generating function solves the arrangement of multiple sets)
猜你喜欢

Analysis of the reasons why enterprises build their own software development teams to use software manpower outsourcing services at the same time

Install apache+php+mysql+phpmyadmin xampp and its error resolution

论文阅读 GloDyNE Global Topology Preserving Dynamic Network Embedding

Win 11 major updates, new features love love.

Data analysis is popular on the Internet, and the full version of "Introduction to data science" is free to download

English grammar_ Adjective / adverb Level 3 - multiple expression
![Golang string (string) and byte array ([]byte) are converted to each other](/img/41/20f445ef9de4adf2a2aa97828cb67f.jpg)
Golang string (string) and byte array ([]byte) are converted to each other

Redis on local access server

多媒体NFT聚合平台OKALEIDO即将上线,全新的NFT时代或将来临

Module 9 operation
随机推荐
[linux]centos 7 reports an error when installing MySQL "no package MySQL server available" no package ZABBIX server MySQL available
Boost.Asio Library
PHP MySQL order by keyword
PHP determines which constellation it belongs to today
Analysis of the reasons why enterprises build their own software development teams to use software manpower outsourcing services at the same time
[Yu Yue education] world reference materials of Microbiology in Shanghai Jiaotong University
204. Count prime
Redis on local access server
webcodecs
2022-2028 global sepsis treatment drug industry research and trend analysis report
Win 11 major updates, new features love love.
2022-2028 global aircraft head up display (HUD) industry research and trend analysis report
Install apache+php+mysql+phpmyadmin xampp and its error resolution
Xception for deeplab v3+ (including super detailed code comments and original drawing of the paper)
English语法_名词 - 分类
Administrative division code acquisition
Torch learning notes (3) -- univariate linear regression model (self training)
图像24位深度转8位深度
Torch learning notes (1) -- 19 common ways to create tensor
This diversion