Search
 
SCRIPT & CODE EXAMPLE
 

SQL

sql truncate statement

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

Truncate Table in SQL

TRUNCATE TABLE Customers;
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 :: change postgress password 
Sql :: mysql update row 
Sql :: mysql first day of month date 
Sql :: how to create enum in postgresql 
Sql :: add column with foreign key constraint sql server 
Sql :: find duplicates mysql 
Sql :: Configure postgresql engine for your django application 
Sql :: sql order by where condition 
Sql :: is mysql and sqlite same 
Sql :: flask sqlalchemy filter multiple conditions 
Sql :: mysql set id auto increment 
Sql :: How to Find Duplicate Values in a SQL Table 
Sql :: remove duplicates sql server select 
Sql :: CONCAT_WS() concat function in mysql 
Sql :: count columns psql(PostreSQL) 
Sql :: sql merge 
Sql :: postgres cast as currency format 
Sql :: mysql create database utf8 
Sql :: get sql instance name 
Sql :: SQL Modify Column in a Table -MySQL 
Sql :: ms sql create user 
Sql :: create sequence postgres 
Sql :: select last row mysql 
Sql :: how to show index type in postgresql 
Sql :: mysql ip address data type 
Sql :: import mysql dump command line 
Sql :: joomla execute raw sql 
Sql :: oracle apex warn on unsaved changes 
Sql :: check if value is equal to something sql 
Sql :: add colum date in sql 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =