Professional Documents
Culture Documents
Set-02
Set-02
Set-02
● Data Query Language (DQL): The commands of SQL that are used
to retrieve data from the database are collectively called DQL. So all
Select statements come under DQL
2. What is the purpose of DDL Language?
Ans: DDL stands for Data definition language. It is the subset of a database
that defines the data structure of the database when the database is created. For
example, we can use the DDL commands to add, remove, or modify tables. It
consists of the following commands: CREATE, ALTER and DELETE database
objects such as schema, tables, indexes, view, sequence, etc.
/
Ans: The commands of SQL that are used to insert data into the database,
modify the data of the database, and delete data from the database are
collectively called DML. Examples include Insert, Update and Delete. This
impacts the Data structure.
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 the where clause with DELETE to filter & delete specific
records.
► The DELETE command is used to remove rows from a table based on the
WHERE conditions.
► It maintains the log, so it is slower than truncates.
► The DELETE statement removes rows one at a time and records an entry
in the transaction log
for each deleted row.
► Identity of column keep DELETE retains the identity.
► To use Delete you need DELETE permission on the table.
► Delete uses more transaction space than a Truncate statement.
► The delete can be used with indexed views.
DROP:
► The DROP command removes a table from the database.
► All the tables' rows, indexes, and privileges will also be removed.
► No DML triggers will be fired.
► The operation cannot be rolled back.
► DROP and TRUNCATE are DDL commands, whereas DELETE is a DML
command.
► DELETE operations can be rolled back (undone), while DROP and
TRUNCATE operations cannot be rolled back.
SQL Questions Set-02
Ans: CHAR is a fixed-length string data type, so any remaining space in the
field is padded with blanks. CHAR takes up 1 byte per character. So, a
CHAR(100) field (or variable) takes up 100 bytes on a disk, regardless of the
string it holds.
NVARCHAR: