Search
 
SCRIPT & CODE EXAMPLE
 

SQL

truncate statement in sql

/*truncate table syntax*/
/*table name is Employees*/
TRUNCATE TABLE Employees;
Comment

what is truncate in sql

DELETE -
-DML COMMAND
-Delete Rows from the table one by one
-We can use where clause with Delete to delete single row
-Delete is slower than truncate
-ROLLBACK is possible with DELETE

DROP-
-DDL COMMAND
-Delete the entire structure or schema
-We can't use where clause with drop
-Drop is slower than DELETE & TRUNCATE
-ROLLBACK IS NOT POSSIBLE WITH DROP

TRUNCATE-
-DDL COMMAND
-Truncate deletes rows at a one goal
-We can't use where clause with Truncate
-Truncate faster than both DELETE & DROP
-Rollback is not possible with Truncate
Comment

truncate syntax in sql

+----+----------+-----+-----------+----------+
| ID | NAME     | AGE | ADDRESS   | SALARY   |
+----+----------+-----+-----------+----------+
|  1 | Ramesh   |  32 | Ahmedabad |  2000.00 |
|  2 | Khilan   |  25 | Delhi     |  1500.00 |
|  3 | kaushik  |  23 | Kota      |  2000.00 |
|  4 | Chaitali |  25 | Mumbai    |  6500.00 |
|  5 | Hardik   |  27 | Bhopal    |  8500.00 |
|  6 | Komal    |  22 | MP        |  4500.00 |
|  7 | Muffy    |  24 | Indore    | 10000.00 |
+----+----------+-----+-----------+----------+
Comment

sql truncate number

-- Truncate number with cast
UPDATE my_table
SET my_column = CAST(my_column AS INT)
WHERE ...;
-- or convert
UPDATE my_table
SET my_column = CONVERT(INT, my_column)
WHERE ...;
Comment

PREVIOUS NEXT
Code Example
Sql :: sqlite rename table 
Sql :: what is in operator 
Sql :: full outer join in sql 
Sql :: sql compiler 
Sql :: convert varchar to time sql 
Sql :: SQL LIKE With Wildcards 
Sql :: how to query a db sqlite3 database in django python 
Sql :: how to delete data from database in php 
Sql :: psotgres multiple values 
Sql :: utf8_encode mysql 
Sql :: get month and year from date in mysql sequelize 
Sql :: How to do IF NOT EXISTS in SQLite 
Sql :: IDE1006 (Naming rule violation) error problem 
Sql :: run sql script file and changes db name in this file using c# 
Csharp :: asp.net data annotations email 
Csharp :: read text file to string c# 
Csharp :: change border color of textfield in flutter 
Csharp :: Changing datagridview cell color dynamically 
Csharp :: unity reset rigidbody velocity 
Csharp :: change sprite of gameobject unity 
Csharp :: how to get the current gameobject animator in unity 
Csharp :: degree to radians c# 
Csharp :: unity android quit application 
Csharp :: how to make console wait c# 
Csharp :: unity movetowards 
Csharp :: how to delay execution in c# 
Csharp :: C# save pdf stream to file 
Csharp :: get path c# 
Csharp :: how to edit Camera.size property unity 
Csharp :: c# take first 4 characters of string 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =