In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Records in the MYSQL operation data table
1 put the number of selected columns to the top
ALTER TABCE table name MODIFY column name and type FIRST of column name
2 modify column name type
ALTERTABCE table name MODIFY column name new column name
3 modify the name of the data table
The first ALTERTABCE original table name RENAME new table name
The second RENAMETABLE new table name TO original table name
4 insert record
The first INSERT table name needs to be copied with the column VALUES (the value to be copied);] the name needs to be''. This is the use of copying only one field.
The second INSERT table name is VALUES (NULL or DEFAULT, such as' name', 'password', 'age', serial number)
The third INSERT table name SET user name = name, user password = password; (only one entry can be inserted)
5 View record
SELECT * FROM table name
6 insert multiple records
The first INSERT table name VALUES (NULL or DEFAULT, such as' name', 'password', 'age', serial number), (NULL, such as' name', 'password', 'age', serial number)
The second INSERT table name is SET user name = 'name' and password = 'password you want to fill in'
7 single table update
7.1 Update a field
UPDATE table name set age = age + the number you want to add; (add the value you fill in to your original value)
7.2 Update multiple fields
UPDATE table name SET age = age-e. G. id, e. G. sex=0; (subtract or set on your original value)
7.3 add updates to the conditions
UPDATE table name SET age = age + 10 WHERE such as id%2=0; (add the value you filled in to your original value, such as if id is even, you can update it)
8 single table delete record
DELETE FROM table name WHERE such as id=6; (delete information with id 6) and then insert id after deletion will only rank back, not the number of deletions.
9 query the columns you want to check
SELECT column name, column name FROM
10 aliases for query columns
SELECT such as id AS userId,username AS uname FROM table name
11 query result grouping
SELECT column name FROM table name GROUP BY column name
12 grouping condition
SELECT column name FROM table name GROUP BY 1 HAVING cound (id) > = 2; (the id of the list name is greater than or equal to 2 when grouped)
13 sort the query results
The first SELECT * FROM table name ORDER BY column name DESC; (descending)
The second SELECT * FROM table name ORDER BY column name; (ascending order)
The third SELECT * FROM table name ORDER BY column name, such as id DESC; (id descending sort of column names)
14 restrict query results
SELECT * FROM table name LIMIT 2; (query the first two pieces of information in the list)
15 put the query results in the specified list
INSERT new list name column name (such as username) SELECT column name (as before) FROM original table name WHERE column name (such as age) > = 30; (put values with username and ag greater than or equal to 30 in the specified list)
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.