In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Data type
Exact number
Approximate number
String
Unicode string
**
1. Create a tabl
Create table table name (column name 1 data type (size), column name 2 data type (size) column name 3 data type (size))
Delete tabl
Drop table
Add column
ALTER TABLE table name
ALTER COLUMN column name data type (size)
Column: alter table www add remarks nvarchar (10)
# add a comment column to the www table
* * modify the data type of the column * * ALTER TABLE table name
ALTER COLUMN column name data type (size)
Column: alter table www alter column remarks nvarchar (1000)
# modify the 'remarks' column data type length to 1000 in the www table
Delete column
ALTER TABLE table name
DROP COLUMN column name
Column: alter table www drop column comment
# delete the "remarks" table name from the www table
Insert data
INSERT [INTO] [column name] VALUES
Column: insert into www values ('10-10-11 'tomatoes,' vegetables', '2.1-10-11')
# add a column of data to the www table
Update data
UPDATE SET [WHERE]
Set can be followed by the values of multiple data columns, and no one where can be used to restrict conditions.
Column: update www set sales Price = 1000 where name = 'Apple'
The sales price of # www update is 1000, effective only for those whose name is Apple.
Delete data
1.delete delete statement
DELETE FROM [WHERE]
Column: delete from www where name = 'Apple'
# Delete the data named Apple in the www table
2.Truncate Table statement
The Truncate Table statement can only be used to delete the contents of the entire table
Column: Truncate table www
# Delete everything in the www table
Data query
Conditional expression
Comparison operator
Wildcard character
Logical operator
Select from www | query www table
Select name, title, base salary from www | query in www table only shows name, position and base salary.
Select name from www where Job = 'Finance Department' | query job in www table = employee of Finance Department
Select from www where salary betweer 8000 and 10000 | query the information of employees with www salary ranging from 8000 to 10000.
Select from www where salary 20000 | query the information of employees with less than 10000 or more than 20000 in www table
Select from www where salary in (8000,9000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000) |
Select from www where name like 'Zhang%' | query employee information whose names begin with Zhang in the www table
Select from www where name like 'Yang%' and Job = 'Finance Department' | query www surname Yang and is an employee of Finance Department
Select from www where hobby is not null | query the information of employees whose hobbies are empty in the www table.
Select top 5 from www | query the first five lines of data in www
Select name as name, sales location as xxx, sales price as ddd from sales | set alias
Select * from www order by basic salary desc | query the employee information of www table and display it from high to low
Select distinct Job from www | query which jobs are in the www table and remove duplicates
Select name, title, gender into new1 from www | query the name, title and gender in the www table, and check it in the new table.
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.