0% found this document useful (0 votes)
37 views1 page

Mysql Sheet-2

DML stands for Data Manipulation Language and SQL stands for Structured Query Language. A relation is a table in a relational database. A candidate key is a set of attributes in a relation that can uniquely identify each tuple. The SHOW DATABASES command is used to list databases in MySQL Server. The Alter command modifies the structure of a table while the Update command modifies the data within a table. The given SQL commands can be used to create a database and table with the given structure and insert sample data. Suitable data types are identified for a MEMBER table and a record with NULL values can be inserted. SQL queries are written to retrieve data from a hypothetical Hospital relation based on various conditions. The Cartesian product of two

Uploaded by

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

Mysql Sheet-2

DML stands for Data Manipulation Language and SQL stands for Structured Query Language. A relation is a table in a relational database. A candidate key is a set of attributes in a relation that can uniquely identify each tuple. The SHOW DATABASES command is used to list databases in MySQL Server. The Alter command modifies the structure of a table while the Update command modifies the data within a table. The given SQL commands can be used to create a database and table with the given structure and insert sample data. Suitable data types are identified for a MEMBER table and a record with NULL values can be inserted. SQL queries are written to retrieve data from a hypothetical Hospital relation based on various conditions. The Cartesian product of two

Uploaded by

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

1 Answer the following questions:

a. Expand the following term:


i. DML ii. SQL
b. What is Relation?
c. What do you understand by CANDIDATE Key?
d. Which command is used to list the databases available in Mysql Server?
e. What is the difference between Alter and Update Command?
f. Consider the structure of a table and answer the following questions.
Field name Field type Field size
TeamCode Varchar 5
TeamName Varchar 20
TeamLeader Varchar 20
NoOfMembers Integer
Team_Symbol Char 1
I. Create database Indian with the table name TEAM with appropriate data type
using SQL command of the above structure:
II. Add a primary key constraint to TeamCode.
III. Insert 1 record
IV. Add a column AgeOfLeader of type Integer with size 2.
V. Write a query to list the records of the table.
g. Identify suitable data types and size for the following MEMBER table attributes and
insert one record in which No_of_bk and No_of_iss is NULL.
Field Name Description
Mem_code Member code (i.e. m01,m02)
Mem_name Member name
Mem_add Member address
Mem_phone Member contact number
No_of_bk Number of books stock
No_of_iss Number of books issued
h. write SQL Commands for the queries (i) to (vi)and write output of SQL commands given
in (vii) to (viii) based on a relation Hospital

1. To select all the information of patients of cardiology department.


2. To list the names of female patients who are in ENT department.
3. To list the names of male patients with age < 30.
4. To list the patients name, age and sex whose name ends with n
5. To list names of all patients with their date of admission in ascending order.
6. To list the details of hospital table which contains NULL value in department.
i. If R1 is a relation with 5 rows and R2 is a relation with 4 rows, how many rows will the
Cartesian product of R1 and R2 have?
j. What is the purpose of USE command? Name the command to remove table from
database.

You might also like