Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

A brief introduction to the manipulation language of mysql database

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following is about the manipulation language of mysql database. The secret of the text is that it is close to the topic. So, no gossip, let's go straight to the following, I believe you will benefit from reading this article on the manipulation language of mysql database.

Addition, deletion, modification and search of Dml language

Addition, deletion, modification and search of dml language

Insert INSERT [INTO] table name [(column name)] VALUES (values list)

Example: INSERT INTO Students (SName,SAddress,SGrade,SEmail,SSEX)

VALUES ('Zhang Qingcai', 'Shanghai Songjiang', 6)

Note 1:

Insert one row of data at a time, not just half a row or several columns of data

The validity of the inserted data will be verified in accordance with the requirements of the integrity of the entire row.

Note 2:

The data type, precision, and number of decimal places for each data value must match the corresponding column

Note 3:

Cannot specify a value for the identity column

Note 4:

If you specify that a column is not allowed to be empty when designing the table, you must insert data

Note 5:

The inserted data item is required to meet the requirements of the check constraint

Note 6:

Columns with default values, you can use the DEFAULT (default) keyword instead of the inserted numeric value

Example:

INSERT INTO Student (StudentNo,LoginPwd,StudentName,Sex,GradeId,Phone,Address,BornDate)

VALUES ('S1200902005' demagogy 'Zhang Feng', 'male', 1 '13212345678' defaults, '1987-6-2')

Insert multiple rows of data

The first method

Add data from an existing table to an existing table through the INSERT SELECT statement

INSERT INTO (column name)

SELECT

FROM

Example: INSERT INTO AddressList (name, address, email)

SELECT SName,SAddress,SEmail

FROM Students

The second method

Add data from an existing table to a new table through a SELECT INTO statement

SELECT (column name)

INTO

FROM

SELECT Students.SName,Students.SAddress,Students.SEmail

INTO AddressList

FROM Students

For the above mysql database manipulation language-related content, is there anything you don't understand? Or if you want to know more about it, you can continue to follow our industry information section.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report