0% found this document useful (0 votes)
4 views3 pages

Differentiation

The document outlines key differences between various database concepts, including DDL vs. DML, CHAR vs. VARCHAR, primary vs. unique key constraints, single vs. multiple row functions, WHERE vs. HAVING clauses, and ORDER BY vs. GROUP BY clauses. Each section provides definitions, usage, and examples to clarify the distinctions. This serves as a concise reference for understanding fundamental database management principles.

Uploaded by

anjukyl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views3 pages

Differentiation

The document outlines key differences between various database concepts, including DDL vs. DML, CHAR vs. VARCHAR, primary vs. unique key constraints, single vs. multiple row functions, WHERE vs. HAVING clauses, and ORDER BY vs. GROUP BY clauses. Each section provides definitions, usage, and examples to clarify the distinctions. This serves as a concise reference for understanding fundamental database management principles.

Uploaded by

anjukyl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

UNIT – III Database Management

-----------------------------------------------------------------------------------------

1. Difference between DDL and DML.


DDL DML

DDL stands for Data Definition Language. DML stands for Data Manipulation
Language.
DDL is used to create databases, schemas, DML is used to select, insert, update, or
constraints, users, tables, etc. delete records.

DDL has no further classification. DML is further classified into procedural DML
and non-procedural DML

Basic commands in DDL include CREATE, Basic commands in DDL include INSERT,
DROP, RENAME ,ALTER etc SELECT, UPDATE ,DELETE etc

2. Difference between CHAR and VARCHAR

CHAR VARCHAR
Used to store character strings of fixed Used to store character strings of variable
length. length.
In CHAR, if the length of the string is In VARCHAR, if the length of the string is
less than the fixed length, it is padded less than the defined length, it is stored as
with extra spaces. is, without being padded with extra spaces.
Variable size; The storage size of the
Fixed size; The storage size of CHAR VARCHAR datatype is equal to the actual
datatypes is equal to the defined length (n length of the entered string in bytes.
bytes).
VARCHAR may be slower due to the need
CHAR is generally faster because it does not for memory allocation according to the
require memory allocation for varying actual length of the data.
lengths

3. Difference between unique and primary key constraints.

PRIMARY KEY Constraint UNIQUE Constraint


Only one PRIMARY KEY can be created More than one UNIQUE constraint can be
on a table. added to a table.
NULL values are not allowed in a column NULL values are allowed in columns with
defined as PRIMARY KEY. a UNIQUE constraint
Values in a PRIMARY KEY column cannot Values in a column with a UNIQUE
be modified or deleted if they are part of constraint can be modified or deleted.
a foreign key reference.

4. Difference between Single row function and multiple function.

Single row function Multiple row function


Operate on a single row of data at a Operate on a set of rows and return a
time. single summary result.
Perform operations on individual values Aggregate or summarize data across
in each row, such as calculations or multiple rows, such as computing totals
transformations. or averages.
Return a single value per row. Return a single value for the entire set of
rows.
Examples: UPPER(), LOWER(), ROUND(), Examples : SUM(), AVG(), COUNT(),
SUBSTR(), CONCAT()etc MAX(), MIN()
It can be used in the SELECT, WHERE It can be used in the SELECT with
clause, Order by clause etc. GROUP BY clause

5. Difference between WHERE Clause and HAVING Clause

WHERE Clause HAVING Clause


Filters records from the table based on Filters groups of records based on
specified conditions specified conditions after aggregation.
Used with SELECT, UPDATE, and DELETE Used only with SELECT statements,
statements. particularly with aggregated data
Applied before the GROUP BY clause. Applied after the GROUP BY clause.
Operates on individual rows of data. Operates on groups of rows created by
GROUP BY and aggregate functions.
Works with single-row functions like Works with aggregate functions like
UPPER(), LOWER(), etc. SUM(), COUNT(), AVG(), etc.
Example : Filtering records where Example : Filtering groups after
individual row values meet certain aggregation (e.g., HAVING COUNT(*) >
conditions (WHERE mark > 50). 5).
6. Difference between ORDER BY Clause and GROUP BY Clause

ORDER BY Clause GROUP BY Clause


Sorts the result set based on specified Groups rows that have the same values
columns. in specified columns into aggregated
data.
Applied after the WHERE, GROUP BY, and Applied before the ORDER BY clause.
HAVING clauses.

You might also like