Structured Query Language
SQL in OpenOffice.org Base
1. What is SQL?
Answer: SQL stands for Structured Query Language. SQL is a Query language used to communicate with a relational database. It is used to make queries in databases and information systems.
2. How do you pronounce SQL?
Answer: SQL is pronounced as “ess-que-el” or “see-quel”.
3. In how many categories SQL commands are classified?
Answer: SQL commands are classified into the following categories:-
(a) Data Definition Language (DDL)
(b) Data Manipulation Language (DML)
(c) Transaction Control Language (TCL)
4. What is DDL?
Answer: DDL stands for Data Definition Language. It allows us to perform tasks related to data definition. for example – creating, altering, dropping, granting, and revoking privileges & roles, and maintenance commands.
5. What is DML?
Answer: DML stands for Data Manipulation Language. DML commands allow performing data manipulation like retrieval, insertion, deletion, and modification of data stored in a database.
6. What is TCL?
Answer: TCL stands for Transaction Control Language. It allows you to manage and control transactions.
7. Write the name of some DDL commands.
Answer: DDL Commands are – CREATE DATABASE, CREATE TABLE, CREATE VIEW, CREATE INDEX, ALTER TABLE, DROP TABLE, DROP DATABASE, etc.
8. Write the name of some DML commands.
Answer: DML Commands are – INSERT INTO, UPDATE, DELETE, SELECT
9. Write the name of some TCL commands.
Answer: TCL Commands are – ROLLBACK, COMMIT, SET SAVEPOINT
10. How to execute SQL command in OpenOffice.org Base?
Answer: In Base, to execute SQL commands (except SELECT query) follow these steps:-
(a) Click Tools -> SQL Command.
(ii) Type your SQL command in the “Command to execute”
(iii) Click Execute button.
11. What is CREATE TABLE?
Answer: CREATE TABLE is a DDL command, which is use to define a table.
Syntax:
CREATE TABLE tablename (
column_name1 datatype (size),
column_name1 datatype (size),
column_name1 datatype (size), ……. );
12. Write SQL command to create the given table – employee.
Field Name | Data Type |
ecode | integer |
ename | character(30) |
sex | character(1) |
grade | character(2) |
gross | decimal |
Answer: CREATE TABLE employee (
ecode integer,
ename char(30),
sex char(1),
grade char(2),
gross decimal
)
13. Match the following:
Column – A | Column – B |
(i) INT | (a) Stores fixed-length string |
(ii) DECIMAL | (b) Stores date values |
(iii) CHAR | (c) Stores real or decimal values |
(iv) VARCHAR | (d) Stores integer values |
(v) DATE | (e) Stores date/time values |
(vi) DATETIME | (f) Stores variable-length values |
Answer: (i) – (d) ; (ii) – (c); (iii) – (a); (iv) – (f); (v) – (b); (vi) – (e);
14. Which command of SQL is used to insert rows in a table?
Answer: INSERT INTO command is used to add the rows or tuples to the relations. It is a DML command.
15. How can insert Dates?
Answer: Dates are inserted in ‘YYYY-MM-DD’ format with the INSERT command.
16. How can insert a NULL value?
Answer: NULL value is inserted with the INSERT command by typing NULL without any quote.