In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to use insert statements in sql, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
The insert statement of SQL is an insert statement that inserts new rows (new data) into the table.
There are three ways to write insert statements:
1. Insert into...values statement
The insert...values statement inserts the specified data into a ready-made table, which can be divided into two cases:
1) there is no need to specify the name of the column to insert data, just provide the value to be inserted:
Insert into table_namevalues (value1,value2,value3,...)
2), you need to specify the column name and the value to be inserted:
Insert into table_name (column1,column2,column3,...) values (value1,value2,value3,...)
2. Insert into...set statement
Like the insert...values statement, the insert...set statement inserts the specified data into the ready-made table. Basic syntax:
Insert into table_name set column1=value1,column2=value2,.
3. Insert into...select statement
The insert...select statement looks up the data from another appearance and inserts it into an off-the-shelf table. Basic syntax:
Insert into table_name select * from table_name2
Example:
Mysql > desc students +-+ | Field | Type | Null | Key | Default | Extra | +-+- -+ | sid | int (11) | YES | | NULL | | sname | varchar (20) | YES | | NULL | | +-+-+ Insert into students values (1) 'aaa') Insert into students set sid=2,sname='bbb';Insert into students select * from students_bak;mysql > select * from students;+-+-+ | sid | sname | +-+-+ | 1 | aaa | | 2 | bbb | | 3 | ccc | +-+-+ above is all about how to use the insert statement in sql. Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.