Get started with adding, modifying and deleting SLQ database tables in 5 minutes! A must-have for software testing engineers!

Add multiple pieces of data to the data table

Method 1: Write multiple insert statements and separate them with English semicolons.

insert into students(name) value('小明');
insert into students(name) value('小张');
insert into students(name) value('小王');

Method 2: Insert multiple pieces of data through one insert statement. Use commas to separate multiple pieces of data. insert into table name value(...),(...),(...)

insert into students(name) value ('alex'),('zhangwu')

Data table modification operations

The keyword for the modification operation is update, and the keyword for conditional judgment is where syntax format:

update table name set field name 1 = value 1, field name 2 = value 2 where condition = xxx

update students set name ='heihei' where id =1

Notice:

Whenever you modify data, you must add conditional restrictions, otherwise the values ​​of all records will be modified.

Delete data (understand)

The keyword of the delete operation is delete from, and the conditional judgment is where

delete from students where id = 2

Notice:

This method is physical deletion and is rarely used in work. Most of the work uses logical deletion.

Logical deletion is to define a field to identify that the current record has been deleted, such as adding a field, is_delete to identify whether it has been deleted, 1 means deleted, 0 means not deleted.

Other methods of deleting data: (Delete the table directly)

1truncate table table name, this method only deletes the data, not the table structure

2 drop table table name, this method deletes data and table structure

Finally: The complete software testing video tutorial below has been compiled and uploaded. Friends who need it can get it by themselves [guaranteed 100% free]

Software Testing Interview Document

We must study to find a high-paying job. The following interview questions are from the latest interview materials from first-tier Internet companies such as Alibaba, Tencent, Byte, etc., and some Byte bosses have given authoritative answers. After finishing this set I believe everyone can find a satisfactory job based on the interview information.

Guess you like

Origin blog.csdn.net/AI_Green/article/details/132855739