Posts

Difference between DROP,TRUNCATE and DELETE

The difference between TRUNCATE , DELETE and DROP   TRUNCATE TRUNCATE is a DDL command TRUNCATE is executed using a table lock and whole table is locked for remove all records. We cannot use Where clause with TRUNCATE. TRUNCATE removes all rows from a table. Minimal logging in transaction log, so it is performance wise faster. TRUNCATE TABLE removes the data by deallocating the data pages used to store the table data and records only the page deallocations in the transaction log. Identify column is reset to its seed value if table contains any identity column. To use Truncate on a table you need at least ALTER permission on the table. Truncate uses the less transaction space than Delete statement. Truncate cannot be used with indexed views. DELETE DELETE is a DML command. DELETE is executed using a row lock, each row in the table is locked for deletion. We can use where clause with DELETE to filter ...

SQL DROP TABLE

SQL DROP TABLE:                                  This statement is used to delete a table definition and all data from a                                    table. Syntax: DROP   TABLE   "table_name" ;   EX:   for example already we have one table ,employee table. if we want delete that table just use DROP statement. SQL> DROP   TABLE  STUDENTS;  

SQL CREATE TABLE

SQL CREATE TABLE: This statement is used to create table in a database. Syntax: create   table  "tablename"   ("column1" "data type",   "column2" "data type",   "column3" "data type",   ...   "columnN" "data type");   Let us take an example to create a EMPLOYEE table with ID as primary key and NOT NULL are the constraint showing that these fields cannot be NULL while creating records in the table. EX: SQL>  CREATE   TABLE  Employee (   ID  INT                                        //NOT NULL,   NAME   VARCHAR  (20)             //NOT NULL,   AGE  INT                       ...

SQL statements and categories

SQL statements are divided into these  categories Data Definition Language (DDL) Statements. Data Manipulation Language (DML) Statements. Transaction Control Statements. Session Control Statements. System Control Statement. Embedded SQL Statements. Data definition language (DDL) :                 these statements  are perform these tasks: Create, alter, and drop schema objects Grant and revoke privileges and roles Analyze information on a table, index, or cluster Establish auditing options Add comments to the data dictionary The DDL statements are: ALTER  ... (All statements beginning with  ALTER) ANALYZE ASSOCIATE   STATISTICS AUDIT COMMENT CREATE  ... (All statements beginning with  CREATE) DISASSOCIATE   STATISTICS DROP  ... (All statements beginning with  DROP) FLASHBACK  ... (All statements beginning with  FLASHBACK ) GRANT NOAUDIT PURGE RENAME REV...

SQL Introduction

Image
SQL:           (Structured Query Language) is utilised to perform operations on the records put away in                     database, for example, refreshing records, erasing records, making and altering tables, sees and           so on          SQL is only query language, it is not a database. To perform SQL queries, you have to                          introduce any database for instance Oracle, MySQL, MongoDB, PostGre SQL, SQL Server,               DB2 and so on. ACID  – The acronym standing for the properties maintained by standard database management systems, standing for  Atomicity ,  Consistency ,  Isolation , and  Durability . Application Server  – A server that processes application-specific database...