Test Index

Structured Query Language (SQL) Get it on Google PlayDownload on the App Store CBSE Board Videos

© examsnet.com
Question : 45 of 58
Marks: +1, -0
(a) Differentiate between CHAR and VARCHAR data types in SQL with appropriate example.
OR
(b) Name any two DDL and any two DML commands.
[CBSE 2023 Set 4]
Solution:  
(a)
CHARVARCHAR
Fixed-length string data type.Variable-length string data type.
CHAR(n) always uses n characters of storage; shorter values are padded with spaces.VARCHAR(n) uses only as many characters as the value has (maximum n).
Example: CHAR(10) storing 'CITY' still uses 10 characters (4 + 6 spaces).Example: VARCHAR(10) storing 'CITY' uses only 4 characters.
OR (b)
DDL (Data Definition Language) commands: CREATE, ALTER (also DROP).
DML (Data Manipulation Language) commands: INSERT, UPDATE (also DELETE, SELECT).
© examsnet.com
Advertisements
Go to Question: