DDL Stands For Data Definition Language. SQL Queries Like CREATE, ALTER, DROP and
DDL Stands For Data Definition Language. SQL Queries Like CREATE, ALTER, DROP and
What are the differences between DDL, DML and DCL in SQL?
Ans: Following are some details of three.
DDL stands for Data Definition Language. SQL queries like CREATE, ALTER, DROP and
RENAME come under this.
DML stands for Data Manipulation Language. SQL queries like SELECT, INSERT and
UPDATE come under this.
DCL stands for Data Control Language. SQL queries like GRANT and REVOKE come under
this.
What is the difference between having and where clause?
Ans: HAVING is used to specify a condition for a group or an aggregate function used in
select statement. The WHERE clause selects before grouping. The HAVING clause selects
rows after grouping. Unlike HAVING clause, the WHERE clause cannot contain aggregate
functions.
What is Join?
Ans: An SQL Join is used to combine data from two or more tables, based on a common field
between them. For example, consider the following two tables.
What is a Trigger?
Ans: A Trigger is a code that associated with insert, update or delete operations. The code is
executed automatically whenever the associated query is executed on a table. Triggers can be
useful to maintain integrity in database.
What is the use of DROP command and what are the differences between DROP,
TRUNCATE and DELETE commands?
Answer: DROP command is a DDL command which is used to drop/delete the existing table,
database, index or view from the database.
The major difference between DROP, TRUNCATE and DELETE commands are:
DROP and TRUNCATE commands are the DDL commands which are used to delete tables
from the database and once the table gets deleted, all the privileges and indexes that are related to
the table also get deleted. These 2 operations cannot be rolled back and so should be used only
when necessary.
DELETE command, on the other hand, is a DML Command which is also used to delete rows
from the table and this can be rolled back.