SQL Tutorials

Consider the following MOVIE database and answer the SQL queries based on it.

MovieID MovieName Category ReleaseDate ProductionCost BusinessCost 001 Hindi_Movie Musical 2018-04-23 124500 130000 002 Tamil_Movie Action 2016-05-17 112000 118000 003 English_Movie Horror 2017-08-06 245000 360000 004 Bengali_Movie Adventure 2017-01-04 72000 100000 005 Telugu_Movie Action – 100000 – 006 Punjabo_Movie Comedy – 30500 – (a) Retrieve movies information without mentioning their column names.Ans: SELECT * FROM MOVIE;(b) […]

Consider the following MOVIE database and answer the SQL queries based on it. Read More »

2. Choose appropriate answer with respect to the following code snippet.
CREATE TABLE student ( name CHAR(30), student_id INT, gender CHAR(1), PRIMARY KEY (student_id));

(i) What will be the degree of student table?a) 30b) 1c) 3d) 4Ans: 3 (degree means columns and total no of columns are 3) (ii) What does ‘name’ represent in the above code snippet?a) A tableb) A rowc) A columnd) A databaseAns: A column (iii) What is true about the following SQL statement?SelecT * fROM

2. Choose appropriate answer with respect to the following code snippet.
CREATE TABLE student ( name CHAR(30), student_id INT, gender CHAR(1), PRIMARY KEY (student_id));
Read More »

School uniform is available at M/s Sheetal Private Limited. They have maintained SCHOOL_UNIFORM Database with two relations viz. UNIFORM and COST. The following figure shows database schema and its state.

(a) Can they insert the following tuples to the UNIFORM Relation? Give reasons in support of your answer.(i) 7, Handkerchief, NULLAns: Yes, it can be inserted as UColor does not have Not Null constraint.(ii) 4, Ribbon, RedAns: No, it cannot be inserted as UCode is Primary key and 4 is already existing and so we

School uniform is available at M/s Sheetal Private Limited. They have maintained SCHOOL_UNIFORM Database with two relations viz. UNIFORM and COST. The following figure shows database schema and its state. Read More »

An organization wants to create a database EMPDEPENDENT to maintain following details about its employees and their dependent.
EMPLOYEE (AadharNumber, Name, Address, Department, EmployeeID)
DEPENDENT (EmployeeID, DependentName, Relationship)

a) Name the attributes of EMPLOYEE, which can be used as candidate keys.b) The company wants to retrieve details of dependent of a particular employee. Name the tables and the key which are required to retrieve this detail.c) What is the degree of EMPLOYEE and DEPENDENT relation? Ans: (a) AadharNumber, EmployeeID (b) To retrieve the

An organization wants to create a database EMPDEPENDENT to maintain following details about its employees and their dependent.
EMPLOYEE (AadharNumber, Name, Address, Department, EmployeeID)
DEPENDENT (EmployeeID, DependentName, Relationship)
Read More »

The school canteen wants to maintain records of items available in the school canteen and generate bills when students purchase any item from the canteen. The school wants to create a canteen database to keep track of items in the canteen and the items purchased by students. Design a database by answering the following questions:

a) To store each item name along with its price, what relation should be used?Decide appropriate attribute names along with their data type. Each item and its price should be stored only once. What restriction should be used while defining the relation?Ans: We will create new relation BILL to keep bill details as per the

The school canteen wants to maintain records of items available in the school canteen and generate bills when students purchase any item from the canteen. The school wants to create a canteen database to keep track of items in the canteen and the items purchased by students. Design a database by answering the following questions: Read More »

A school has a rule that each student must participate in a sports activity. So each one should give only one performance for sport activity. Suppose there are five students in a class, each having a unique roll number. The class representative has prepared a list of sports preferences as shown below. Answer the following:

a) Roll no 24 may not be interested in sports. Can a NULL value be assigned to that student’s preferences field? Ans: Yes, a NULL value can be assigned. b) Roll no 17 has given two preferences sports. Which property of relational DBMS is violated here? Can we use any constraint or key in the

A school has a rule that each student must participate in a sports activity. So each one should give only one performance for sport activity. Suppose there are five students in a class, each having a unique roll number. The class representative has prepared a list of sports preferences as shown below. Answer the following: Read More »

What are the limitations of file system that can be overcome by a relational DBMS?

The limitation if file systems that can be overcome by a relational DBMS are: Data Redundancy: redundancy means repetition of same data in different tables. Redundancy leads to excess data storage and may cause data inconsistency. Data Inconsistency: When same data is managed differently in different places leads to data inconsistency. Data inconsistency creates unreliable

What are the limitations of file system that can be overcome by a relational DBMS? Read More »

error: Content is protected !!