In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
What are the basic operations of the database? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.
One: the basic operation of the library
Premise: connect to the database
1. Add, create database
Use the default code set
Create database db1; # db1 is the database name
Custom code set
Create database db1 charset= "gbk"
two。 Check, view all the information in the database
Look at all the databases: show databases
Details: show create database db1
3. Change, modify the database code set
Alter database db1 charset= "utf8"
4. Delete, remove database
Drop database db1
Two: the basic operation of the table
Premise: create a table under a specific library
Enter the specified database: use db1
Determine which database is currently in use: select database ()
1. Add, create table (field 1, type,..., field n type)
Create table T1 (name char,age int)
two。 Check, view table information
Look at all the databases: show tables
Details: show create table T1
Table field structure information: desc T1
3. Modify, modify field properties
Alter table T1 modify name char (20)
Modify field name
Alter table T1 change name usr char (16)
Modify table name
Alter table t1 rename t2
4. Delete, delete table
Drop table t1
Three: the basic operation of fields
Premise: know which table to operate
1. Add, add field
Insert into T1 (usr,age) values ("aa", 18), ("bb", 8)
two。 Check
Select * from T1
3. Change
Update T1 set age=28 where usr= "aa"
4. Delete
Delete from T1 where age > 8; the answers to the questions about the basic operation of the database are shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
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.