当前位置:网站首页>Knowledge about SQL - DML

Knowledge about SQL - DML

2022-06-26 04:05:00 Code Xiaoyou

DML: Add, delete and modify the data in the table

1. Add data :

        * grammar :

                insert into Table name ( Name 1, Name 2,..... Name n)value( value 1, value 2,..... value n);

        * Be careful :

                1. Column name and value should correspond one by one .

                2. If the name comes after , No column name defined , The default is to add values to all columns .

                         insert into Table name value( value 1, value 2,..... value n);

                3. Except for the number type , Use quotation marks for other types ( Single and double can ) Lead up

2. Delete data :

        * grammar :

                delete from Table name [where Conditions ]

        * Be careful :

               1. If there is no condition , All records in the table will be deleted .

               2. If you want to delete all records

                      1.delete from Table name ;-- It is not recommended to use . The number of records is the number of delete operations

                      2.truncate table Table name ; -- Recommended . Efficient , Delete the table first , Generating an identical table .

3. Modifying data :

        * grammar :

                update Table name set Name 1 = value 1, Name 2 = value 2,...[where Conditions ];

        * Be careful :

                1. If no condition is added , All records in the table will be newly modified .

原网站

版权声明
本文为[Code Xiaoyou]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202180540095037.html