In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following is mainly to bring you to add, delete and check MySQL analysis, I hope that add, delete and check MySQL analysis can bring you practical use, this is also the main purpose of my editing this article. Okay, no more nonsense, let's go straight to the following.
MySQL relational database RDS in the very foundation is also very important, add, delete and change is the basis of MySQL entry, database it to say MySQL database add, delete and change common statements.
Add, delete, and search statements:
Added: insert
Delete: delete
Update: Update
Select or Show
Library operations:
Create database shujukuba;
Create database mydb2 CHARACTER SET=utf8;
Create database mydb3 CHARACTER SET=utf8 COLATE utf8_general_ci;
Show databases: show databases;
Delete database: DROP DATABASE shujukuba;
Alter DATABASE shujukuba character set gb2312;
Table operations:
Create a database table (create a table named employee, which contains id, name, sex, birthday, job fields):
create table employee(
id int,
name varchar(40),
sex char(4),
birthday date,
job varchar(100),);
Add image field to table: alter table employee add image blob; modify job value to 60(original length is 1000): alter table employee modify job varchar(60);
Delete sex column: alter table employee drop sex; change table name to user(formerly employee): rename table employee to user;
Change the character set of the table to utf-8: alter table user character set utf8;
column name changed to username: alter table user change column name username varchar(100);
drop table user;
Example Preparation Table for Addition, Deletion, Revision and Query:
create table employee
(
id int,
name varchar(40),
sex varchar(4),
birthday data,
salary decimal(8,2),
resume text
);
Insert table data:
insert into employee(id,name,sex,birthday,entry_date,salary,resume)values(1,'zhangsan','male','1993-03-04','2016-11-10','1000','i am a developer');
insert into employee(id) values(6);
insert into employee(id,name) values(6,'Zhang San');
Modify table data:
Modify the salary of all employees to 5000 yuan: update employee set salary=5000; modify the salary of the employee named 'zs' to 3000 yuan: update employee set salary = 3000 where name='zhangsan';
Change the salary of the employee whose name is 'aaa' to 4000 yuan,job to ccc: update employee set salary = 4000,job='ccc' where name='Zhang San';
Increase wu's salary by 1000 yuan on the original basis: update employee set salary = salary+1000 where name='Zhang San';
Delete table data:
Delete from employee where job='ccc';
Delete all records in the table: delete from employee;
Use truncate to delete records in the table: truncate table employee;
Query table data: Wuxi Bohai Hospital https://yyk.familydoctor.com.cn/20612/
Select id,name,chinese,english,math from student;
Select name,English from student;
Select * from student where name='Zhang San';
Select * from students where English>'90';
Select * from students where English>=80 and English=
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.