Holiday HW
Holiday HW
Write MYSQL query to create the table Employee as per the following structure:
Column-Name Data-type Size Description
Ecode integer 6 Employee Code
Ename varchar 15 Employee Name
Dept Varchar 8 Employee Department
Salary Decimal 10,2 Salary
Doj Date 8 Date of Joining
OR
What is relational operator?
Based on mysql, answer the following questions
a. Define DBMS?
b. What is data Redundancy in DBMS?
c. How many Primary Keys can exists in any table?
d. If R1 is a relation with 5 rows and 6 columns after adding 1 row and 1 column, what is
the degree and cardinality of R1 ?
e. Give one advantage of using a primary key?
OR
See the following table and Write output for (i) to (iv)
Table :WORKER
ENO NAME DOJ DOB GENDE DCOD
R E
1001 Ganesh 2013-09- 1991-09-01 MALE D01
02
1002 Rudrika 2012-12- 1990-12-15 FEMALE D03
11
1003 Mithlesh 2013-02- 1987-09-04 MALE D05
03
1007 Anand 2014-01- 1984-10-19 MALE D04
17
1004 Meghna 2012-12- 1986-11-14 FEMALE D01
09
1005 Ravindra 2013-11- 1987-03-31 MALE D02
18
1006 Jyoti 2014-06- 1985-06-23 FEMALE D05
09
(i) Select ENO, Name, Gender from WORKER order by ENO desc;
(ii) Select Name from WORKER where Gender = ”MALE”;
(iii) Select Eno, Name from WORKER where Name in (‘Anand’, ‘Jyoti’, ‘Ganesh’)
(iv) select NAME from WORKER where GENDER=”FEMALE” and DOJ> ‘1986-01-01’;
(v) Select distinct(DCODE) from WORKER.
Relation: Gym
PrCode PrName UnitPrice Manufacturer
(a) Display the names of all the products with unit price less than Rs.
20000.
(b) Display details of all the products with unit price in the range 20000 to
30000.
(c) Display the names of all the products manufactured by “Fit Express”.
(d) Change the Unit Price data of all the rows by applying a 15%
discount reduction on all the products.
(e) Delete all the records from the table
(f) Display details of all products with manufacturer name starting with "A".
a. Rewrite the following code after underlying and removing syntax errors:
name = ("Enter Driver Name :" )
age = int(input("Enter Driver Age: ")
if age = > 18 :
print(name, “is eligible for driving license")
else
print(name, "is not eligible for driving license")
OR
a. Find the output of the following :
L=["Class","XI","has",["CS","IP"],"in","the","subject","computer","science"]
print(L[6:])
print(L[3][1].lower())
print("in" in L)
print(L[7][:3] + L[8][3:])
b. Write a program which accept the name and basic salary of an employee .
Calculate and display the name, gross salary and net salary of the employee
when:
da = 30 % of Basic
hra = 18 % of Basic
pf = 12.5 % of Basic
gross = basic + da + hra
net = gross - pf
OR
b. In an examination, if student secured marks more than or equal to 33, result
should be “pass” otherwise “not pass” and also the grades are awarded to
students in Class XI Commerce according to the percentage marks obtained in
the examination.
Percentage Grades
70% and above Distinction
60% or more but less 70% First Division
40% or more but less 60% Second Division
33% or more but less 40% Pass
Less than 33% Grade not awarded
Write a Python program that accepts name of students and percentage of marks as input
and display the result as pass or not pass and grades obtained according to their
percentage.
(e.g. if percentage is 65, then output should print result pass and Grade First Division
Check the table STOCK given below:-
Write SQL queries for the following:
(a) To display the records in ascending order of quantity.
(b) To display all the Products if price is ranged between 2000 to 5000.
(c) To display the Prod name and Category of the products whose name starts with “M”
OR
Insert a new record for stock with following value: {“ 9,”Socket”, “NW”, 20,1000}
Consider the following tables MOVIE . Write outputs of SQL commands for the statements
(i) to (iv) :
Table :MOVIE
MovieI MovieNam Catego ReleaseD Producti Busin
D e ry ate on ess
Cost Cost
001 Hindi_Movie Musical 2018-04- 1245 130000
23 00
002 Tamil_Movie Action 2020-05- 1120 118000
17 00
003 English_Mov Horror 2019-08- 2450 360000
ie 06 00
004 Bengali_Mov Adventu 2022-01- 7200 100000
ie re 04 0
005 Telugu_Movi Action NULL 1000 200000
e 00
006 Punjabi_Mov Comedy NULL 3050 40000
ie 0
(i) SELECT * FROM MOVIE WHERE Category = ‘Action’;
(ii) SELECT MovieName, Category FROM Movie WHERE PorductionCost <=100000 ;
(iii) SELECT * FROM Movie WHERE Category LIKE "A%" ;
OR
SELECT DISTINCT CATEGORY FROM MOVIE ;