THE INDIAN COMMUNITY SCHOOL, KUWAIT SERIES : II MID TERM /FN/ 18-19 CODE : M 065 TIME ALLOWED : 2 HOURS NAME OF STUDENT : MAX. MARKS : 50 ROLL NO. :.. CLASS/SEC :.. NO. OF PAGES : 3 INFORMATICS PRACTICES ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1) Answer the following questions: 10x2= a) What is Mysql? What are its Characteristics? b) Classify Mysql according to its Category. Explain each. c) What is the difference between char() and varchar(). d) Differentiate between primary key and unique key. e) Differentiate between drop table and delete with example. f) How the Alternate Key different from Candidate key. g) What are Constraints?. What are the different types of Constraints. Explain. h) What is a MySQL function? What are the different types of functions Explain with example. i) Write the syntax for the following: I. To Extract the name of the weekday for the date passed II. To return the Numerical value of a Character j) Write the syntax for the following: i. To Search the first occurrence of a character in the string ii. To check the given number is positive or negative 2) Write an SQL query to create a table Employee with proper Syntax and constraints. 2 Attribute Data type Size Constraint Ecode Integer 10 Not Null, Primary key Ename Varchar Not Null Sex Char 1 Not Null Grade Char 2 Default grade = E1 Gross Decimal 10 Check Gross should be morethan 00. Deptno Integer 6 Default can be 10 3) Write SQL commands for the table Club given below: 3x1=3 Table: CLUB Cid Coachname Age Sports DateofApp Pay Sex 1 Ravina 34 Karate 1998-01- 10 F 2 Kukreja 35 Karate 1996-03-27 1000 M 3 Karan 34 Squash 1999-02-19 Null M 4 Tarun 33 BasketBall 1999-01-01 1500 M 5 Ketaki 36 Swimming 00-01-12 750 F
a) Display all the female coaches in alphabetical order who joined after 1998 with salary more than 1000. b) Add a new column address into the table CLUB. c) To Delete the table club including its structure. 4) Write SQL commands for the table Teacher given below. 12x1=12 Table: TEACHER No. Name Age Department Dateofjoin Salary Sex 1 Zainab 34 Computer 07-01-10 199.75 M 2 Sharmila 31 History 08-03-24 0.00 F 3 Sandeep 32 Maths 06-12-12 0.00 M 4 Aswini 35 Computer 09-01-17 480.75 F 5 Rakesh 42 Maths 07-05-09 254.00 M 6 Shyam 50 History 08-06-27 5.00 M 7 Shiva 44 Computer 07-02-25 999.50 M 8 Shalakha 33 Maths 07-07-31 240.85 F a) To list the names of all teachers in uppercase with their date of join in descending order. b) Increase the salary of all male teacher by 10% whose age is not in the range of to 40. c) To insert a new row in the table with the following data without using null : 10, Rajesh, Computer, M d) Display the name starts with S,ends with a only from Computer and Maths department. e) Delete all the teachers who joined in the month of June 1998. Display all the teachers in the following format: <name> were working in <department> drawing <salary> f) To list all teachers whose annual salary is more than 200. g) Remove the column called age from the table teacher. h) Display different departments from teacher table. Write the Output for the following: i) Select dayofmonth (dateofjoin), name from teacher where salary between 0 and 0; j) Select substr (name,2,3) from teacher where department = computer order by name; k) Select year (dateofjoin) + Month(dateofjoin) from teacher where age > 35 ; l) Select round (salary, -1) + truncate (salary, -2) from teacher where sex = M ; 5) Find the output for the following : 13x1=13 Table : emp Empno Ename Job Mgr Hiredate Sal Comm Deptno 8369 SMITHA CLERK 8902 1992-12-18 5800 8499 8521 8566 8654 ANYA SETH DEVAN MOMIN BINA MANAGER PRESIDENT ANALYST 1991-02- 1992-02-22 1991-04-02 1993-09-28 1993-05-01 1600 4985 4850 10 1500 1400 00 10 a) Select ename,comm from emp where length( ename ) < 5 and comm Is not null. b) Select substr( ename,-3 ), left (job,3) from emp where deptno= ; c) Select * from emp order by deptno desc ; d) Select year ( hiredate ) + month( hiredate) from emp where ename like %n ;
e) Select ename from emp where Sal >= 00 and year( hiredate ) between 1991 and 1992; f) SELECT RIGHT ( LEFT ( software, 5), 2); g) SELECT INSTR ( SUBSTR ( PROGRAMMING IS FUN,8,9 ), U ) ; h) SELECT DAYOFYEAR (CURDATE()) + DAYOFMONTH ( 14-03-01 ); i) SELECT ROUND (76.987, -2) + TRUNCATE (999.99,-1); j) SELECT MOD (-27,4) + POW (2,6) ; k) SELECT CHAR(50,70,100) + ASCII( BAD ); l) SELECT LEFT(RIGHT( MATHEMATICS,8),5); m) SELECT SUBSTR(LEFT( MATHEMATICS,8),-5); #####################
The Indian Community School,Kuwait II mid semester Examination Class XI Informatics Practices Answer key Time 2 hrs Marks : 50 2) Answer the following questions: k) Definition Mysql (1) Characteristics (1) l) Classify Mysql according to its Category. Explain each. m) Difference between char() and varchar(). n) Difference between primary key and unique key. o) Difference between drop table and delete with example. p) Difference between Alternate Key different from Candidate key. q) Definition of Constraints. types. r) MySQL function. types. s) Write the syntax for the following: III. Dayname() IV. ASCII() t) Write the syntax for the following: iii. INSTR() iv. SIGN() 6) Create table Employee 7) Write SQL commands for the table Club given below: Table: CLUB Cid Coachname Age Sports DateofApp Pay Sex 1 Ravina 34 Karate 1998-01- 10 F 2 Kukreja 35 Karate 1996-03-27 1000 M 3 Karan 34 Squash 1999-02-19 Null M 4 Tarun 33 BasketBall 1999-01-01 1500 M 5 Ketaki 36 Swimming 00-01-12 750 F d) Select command syntax (1) e) Alter table syntax.(1) f) Drop table club. (1) 8) SQL commands for the table Teacher given below. 12x1=12 Table: TEACHER No. Name Age Department Dateofjoin Salary Sex 1 Zainab 34 Computer 07-01-10 199.75 M 2 Sharmila 31 History 08-03-24 0.00 F 3 Sandeep 32 Maths 06-12-12 0.00 M 4 Aswini 35 Computer 09-01-17 480.75 F 5 Rakesh 42 Maths 07-05-09 254.00 M 6 Shyam 50 History 08-06-27 5.00 M 7 Shiva 44 Computer 07-02-25 999.50 M 8 Shalakha 33 Maths 07-07-31 240.85 F m) Select syntax with ucase / order by. n) Update syntax / between. o) Insert into teacher (col name) values(10, Rajesh, Computer, M ) p) Select syntax with in clause. q) Delete command with month / year function. r) Select syntax with <name> were working in <department> drawing <salary> s) Select syntax with salary*12 >200. t) Alter table teacher drop age. u) Select distinct (departments) from teacher.
Write the Output for the following: v) Select dayofmonth (dateofjoin), name from teacher where salary between 0 and 0; w) Select substr (name,2,3) from teacher where department = computer order by name; x) Select year (dateofjoin) + Month(dateofjoin) from teacher where age > 35 ; y) Select round (salary, -1) + truncate (salary, -2) from teacher where sex = M ; 9) Find the output for the following : 13x1=13 Table : emp Empno Ename Job Mgr Hiredate Sal Comm Deptno 8369 8499 8521 8566 8654 SMITHA ANYA SETH DEVAN MOMIN BINA CLERK MANAGER PRESIDENT ANALYST 8902 1992-12-18 1991-02- 1992-02-22 1991-04-02 1993-09-28 1993-05-01 5800 1600 4985 4850 10 1500 1400 00 10 n) Select ename,comm from emp where length( ename ) < 5 and comm Is not null. o) Select substr( ename,-3 ), left (job,3) from emp where deptno= ; p) Select * from emp order by deptno desc ; q) Select year ( hiredate ) + month( hiredate) from emp where ename like %n ; r) Select ename from emp where Sal >= 00 and year( hiredate ) between 1991 and 1992; s) tw; t) 0; u) DAYOFYEAR (CURDATE()) + DAYOFMONTH ( 14-03-01 ); v) 100+990; w) -3 + 64 ; x) 2E66; y) HEMAT; z) HEMATICS; #####################