12th Standard Syllabus & Materials
12th Standard
TN 12th Computer Applications மின்னணு தரவு பரிமாற்றம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின் - வணிக பாதுகாப்பு அமைப்புகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின்னணு செலுத்தல் முறைகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications மின் - வணிகம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications திறந்த மூல கருத்துருக்கள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications வலையமைப்பு வடமிடல் Sample Question Papers Study Material - QB365 Set A

Published on: 14/10/2019
Structured Query Language
Download Tamil Nadu 12th Standard Computer Science question papers, model tests, one-mark questions, important questions, and public exam papers in PDF format. Free study materials and answer keys for TN State Board students.
Questions + Answers key
Take MCQ Computer Science Test

1.
Write a SQL statement using DISTINCT keyword.
2.
Write the use of Savepoint command with an example.
3.
Write any three DDL commands.
4.
Write a SQL statement to modify the student table structure by adding a new field.
5.
What is a constraint? Write short note on Primary key constraint.
6.
Write a SQL statement to create a table for employee having any five fields and create a table constraint for the employee table.
7.
Construct the following SQL statements in the student table-
(i) SELECT statement using GROUP BY clause.
(ii) SELECT statement using ORDER BY clause.
8.
What are the components of SQL? Write the commands in each.
9.
Consider the following employee table. Write SQL commands for the qtns.(i) to (v).
| EMP CODE | NAME | DESIG | PAY | ALLOWANCE |
| S1001 | Hariharan | Supervisor | 29000 | 12000 |
| P1002 | Shaji | Operator | 10000 | 5500 |
| P1003 | Prasad | Operator | 12000 | 6500 |
| C1004 | Manjima | Clerk | 8000 | 4500 |
| M1005 | Ratheesh | Mechanic | 20000 | 7000 |
(i) To display the details of all employees in descending order of pay.
(ii) To display all employees whose allowance is between 5000 and 7000.
(iii) To remove the employees who are mechanic.
(iv) To add a new row.
(v) To display the details of all employees who are operators.
10.
1.
(i) The DISTINCT keyword is used along with the SELECT command to eliminate duplicate rows in the table. This helps to eliminate redundant data.
(ii) For Example: SELECT DISTINCT Place FROM Student;
Will display the following data as follows:
Place
Chennai
Banglore
Delhi
2.
(i) The SAVEPOINT command is used to temporarily save a transaction so that you can rollback to the point whenever required.
(ii) The different states of our table can be saved at any time using different names and the rollback to that state can be done using the ROLLBACK command.
(iii) SAVEPOINT savepoint_name:
UPDATE student SET Name = 'Mini' WHERE Admno=105;
SAVEPOINT A;
3.
Data Definition Language:
(i) Create Command: To create tables in the database.
CREATE TABLE Student
(Admno integer,
Name char(20),
Gender char(1),
Age integer,
Place char(10),
);
(ii) Alter Command: The ALTER command is used to alter the table structure like adding a column, renaming the existing column, change the data type of any column or size of the column or delete the column from the table.
ALTER TABLE <table-name> ADD <column-name><data type><size>;
To add a new column "Address" of type 'char' to the Student table, the command is used as
ALTER TABLE Student ADD Address char;
(iii) Drop Command: The DROP TABLE command is used to remove a table from the database.
The table can be deleted by DROP TABLE command in the following way:
DROP TABLE table-name;
4.
ALTER TABLE <table-name> ADD <column- name><data type><size>;
Example: ALTER TABLE Student MODIFY Address char (25)
5.
Constraint:
Constraints are used to limit the type of data that can go into a table. This ensures the accuracy and reliability of the data in the database. Constraints could be either on a column level or a table level. Constraint is a condition applicable on a field or set of fields.
Primary key constraint:
(i) This constraint declares a field as a Primary key which helps to uniquely identify a record.
(ii) It is similar to unique constraint except that only one field of a table can be set as primary key.
(iii) The primary key does not allow NULL values.
6.
Table constraint:
Table constraint apply to a group of one or more columns. The Syntax tor a table created with Constraint is given as below:
CREATE TABLE <table_name>
(<column name> <datatype>[<size>]
<column constraint>,
(<column name> <data type> [<size>]
<column constraint).....
<table constraint>(<column name>, [<column name>..........])............);
Following is an example for employee table with "NOT NULL' column constraint. This constraint enforces a field to always contain a value.
CREATE TABLE employee (No int NOT NULL PRIMARY KEY,
NAME varchar(50), Age int (10), Address varchar(50)
PhoneNo int(10), Pincode int (6) PRIMARY KEY (NAME, PhoneNo);
The above command creates a table "employee" in which the field No of integer type is defined NOT NULL, which means this field must have values. The field NAME is of char type. The fields NAME, PhoneNo, have table constraint.
7.
1. SELECT * FROM student WHERE gender = Male GROUP BY gender;
2. SELECT * FROM student WHERE Age > 18 ORDER BY DESC;
8.
SQL commands are divided into five categories:
Data Definition Language:
(i) The Data Definition Language (DDL) consist of SQL statements used to define the database structure or schema.
(ii) It simply deals with descriptions of the database schema and is used to create and modify the structure of database objects in databases.
(iii) The DDL provides a set of definitions to specify the storage structure and access methods used by the database system.
DDL performs the following functions:
(i) It should identify the type of data division such as data item, segment, record and database file.
(ii) It gives a unique name to each data item type, record type, file type and data base.
(iii) It should specify the proper data type.
(iv) It should define the size of the data item.
(v) It may define the range of values that a data item may use.
(vi) It may specify privacy locks for preventing unauthorized data entry.
Commands:
| CREATE | To create tables in the database. |
| ALTER | Alters the structure of the database |
| DROP | Data tables from database. |
| TRUNCATE | Remove all records from a table, also release the space occupied bv those records. |
Data Manipulation Language:
This is a computer programming language used for adding, removing and modifying data in a database. This language comprises the SQL-data change statements, which modify stored data but not the schema of the database table
Data Manipulation includes
(i) Insertion of new information into the database
(ii) Retrieval of information stored in a database
(iii) Deletion of information from the database.
(iv) Modification of data stored in the database
The DML is basically of two types:
Procedural DML - Requires a user to specify what data is needed and how to get it.
Non-Procedural DML - Requires a user to specify what data is needed without Specifying how to get it.
Commands:
| INSERT | Inserts data into a table |
| UPDATE | Updates the existing data within a table |
| DELETE | Deletes all records from a table, but not the space occupied by them. |
Data Control Language:
(i) A Data Control Language (DCL) is a programming language used to control the access of data stored in a database. It is used for controlling privileges in the database (Authorization).
(ii) The privileges are required for performing all the database operations such as creating sequences, views of tables etc.
Commands:
| GRANT | Grants permission to one or more users to perform specific tasks. |
| REVOKE | Withdraws the access permission given by the GRANT statement. |
Transactional Control Language:
Transactional control language (TCL) commands are used to manage transactions in the database. These are used to manage the changes made to the data in a table by DML statements.
Commands:
| COMMIT | Saves any transaction into the database permanently. |
| ROLL BACK | Restores the database to last commit state. |
| SAVE POINT | Temporarily save a transaction so that you can rollback. |
Data query language:
The Data Query Language consist of commands used to query or retrieve data from a database. One such SQL command in Data Query Language is
| SELECT | It displays the records from the table. |
9.
(i) SELECT * FROM Employee ORDER BY PAY DESC;
(ii) SELECT * FROM Employee WHERE ALLOWANCE
BETWEEN 5000 AND 7000;
(iii) DELETE FROM Employee WHERE DESIG='Mechanic';
(iv) ALTER TABLE employee ADD Age Varchar(50);
(v) SELECT * FROM Employee WHERE DESIG='Operator';
10.
12th Standard Syllabus & Materials
12th Standard
TN 12th Computer Applications களப்பெயர் முறைமை (DNS) Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications வலையமைப்பு எடுத்துக்காட்டுகள் மற்றும் நெறிமுறைகள் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications கணினி வலையமைப்பு ஓர் அறிமுகம் Sample Question Papers Study Material - QB365 Set A
NEW12th Standard
TN 12th Computer Applications PHP-உடன் MySQL-ஐ இணைத்தல் Sample Question Papers Study Material - QB365 Set A
Tamilnadu Stateboard 12th Standard Subjects

Maths

Chemistry

Physics

Biology

Computer Science

Business Maths and Statistics

Economics

Commerce

Accountancy

History

Computer Applications

Biology

Computer Technology

Computer Applications

Computer Science

Business Maths and Statistics

Commerce

Economics

Maths

Chemistry

Physics

Computer Technology

History

Accountancy

Tamil

English

French
Tamilnadu Stateboard Standards