Advertisements
Advertisements
Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii), which are based on the tables.
DVD
| DCODE | DTITLE | DTYPE |
| F101 | Henry Martin | Folk |
| C102 | Dhrupad | Classical |
| C101 | The Planets | Classical |
| F102 | Universal Soldier | Folk |
| R102 | A day in life | Rock |
MEMBER
| MID | NAME | DCODE | ISSUEDATE |
| 101 | AGAM SINGH | R102 | 2017-11-30 |
| 103 | ARTH JOSEPH | F102 | 2016-12-13 |
| 102 | NISHA HANS | C101 | 2017-07- 24 |
1) To display all details from the table MEMBER in descending order of ISSUEDATE
2) To display the DCODE and DTITLE of all Folk Type DVDs from the table DVD.
3) To display the DTYPE and number of DVDs in each DTYPE from the table DVD.
4) To display all NAME and ISSUEDATE of those members from the table. MEMBER who have DVDs issued (i.e., ISSUEDATE) in the year 2017
5) SELECT MIN(ISSUEDATE) FROM MEMBER
6) SELECT DISTINCT DTYPE FROM DVD;
7) SELECT D.DCODE, NAME, DTITLE FROM DVD D, MEMBER M WHERE D.DCODE=M.DCODE;
8) SELECT DTITLE FROM DVD WHERE DTYPE NOT IN ("Folk", "Classical" ) ;
Concept: Structured Query Language Advantages of Using SQL
Observe the following table carefully and· write the names of the most appropriate columns, which can be considered as (i) candidate keys and. (ii) primary key:
| Code | Item | Qty | Price | Transaction Date |
| 1001 | Plastic Folder 14" | 100 | 3400 | 2014-12-14 |
| 1004 | Pen Stand Standard | 200 | 4500 | 2015-01-31 |
| 1005 | Stapler Mini | 250 | 1200 | 2015-02-28 |
| 1009 | Punching Machine Small | 200 | 1400 | 2015-03-12 |
| 1003 | Stapler Big | 100 | 1500 | 2015-02-02 |
Concept: Introduction to Data Base Concepts and Its Need in C++
Consider the following DEPT and EMPLOYEE tables. Write SQL queries for (i) to (iv) and find outputs for SQL queries (v) to (viii).
Table: DEPT
| DCODE | DEPARTMENT | LOCATION |
| D01 | INFRASTRUCTURE | DELHI |
| D02 | MARKETING | DELHI |
| D03 | MEDIA | MUMBAI |
| D04 | FINANCE | KOLKATA |
| D05 | HUMAN RESOURCE | MUMBAI |
Table: EMPLOYEE
| ENO | NAME | DOJ | DOB | GENDER | DCODE |
| 1001 | George K | 2013-09-02 | 1991-09-01 | MALE | D01 |
| 1002 | Ryma Sen | 2012-12-11 | 1990-12-15 | FEMALE | D03 |
| 1003 | Mohitesh | 2013-02-03 | 1987-09--04 | MALE | D05 |
| 1007 | Anil Jha | 2014-01-17 | 1984-10-19 | MALE | D04 |
| 1004 | Manila Sahai | 2012-12-09 | 1986-11-14 | FEMALE | D01 |
| 1005 | R SAHAY | 2013-11-18 | 1987-03-31 | MALE | D02 |
| 1006 | Jaya Priya | 2014-06-09 | 1985-06-23 | FEMALE | D05 |
Note: DOJ refers to the date of joining ·and DOB refers to the date of Birth of employees
1) To display Eno, Name, Gender from the table EMPLOYEE in ascending order of Eno.
2) To display the Name of all the MALE Employees from the table EMPLOYEE.
3) To display the Eno and Name of those employees from the table EMPLOYEE who are born between '1987-01-01' and '1991-12-01'.
4) To count and display FEMALE employees who have Joined after '1986-01-01'.
5) SELECT COUNT(*), DCODE FROM EMPLOYEE GROUP BY DCODE HAVING COUNT(*)>1;
6) SELECT DISTINCT DEPARTMENT FROM DEPT;
7) SELECT NAME, DEPARTMENT FROM EMPLOYEE E, DEPT D WHERE E.DCODE=D.DCODE AND EN0<1003;
8) SELECT MAX(DOJ), MIN(DOB) FROM EMPLOYEE;
Concept: Structured Query Language Advantages of Using SQL
State any one Absorption Law of Boolean Algebra and verily it using truth table.
Concept: Truth Tables (Boolean Algebra)
Draw the Logic Circuit of the following Boolean Expression
(U' + v).(V' + W')
Concept: Application of Boolean Logic - Digital Electronic Circuit Design Using Basic Logic Gates (NOT, AND, OR, NAND, NOR)
Derive a Canonical POS expression for a Boolean function FN, represented by the following truth truth table:
| X | y | z | FN (X, Y, Z) |
| 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 1 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
Concept: Obtaining Sum of Product (SOP) and Product of Sum (POS) Form the Truth Table
Reduce the following Boolean Expression to its simplest form using K-Map:
`G(U, V,W, Z) = sum(3,5 , 6 , 7 , 11 , 12 ,13, 15)`
Concept: Reducing Boolean Expression (SOP and POS) to Its Minimal Form
State DeMorgan's Laws of Boolean Algebra and verify them using a truth table.
Concept: DeMorgan’S Law/Theorem and Their Applications
Draw the Logic Circuit of the following Boolean Expression using only NOR Gates
(A+B).(C+D)
Concept: Application of Boolean Logic - Digital Electronic Circuit Design Using Basic Logic Gates (NOT, AND, OR, NAND, NOR)
Derive a Canonical POS expression for a Boolean function G, represented by the following truth table:
| X | Y | Z | G(X, Y, Z) |
| 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 1 |
| 0 | 1 | 1 | 0 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 1 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
Concept: Obtaining Sum of Product (SOP) and Product of Sum (POS) Form the Truth Table
Reduce the following Boolean Expression to its simplest form using K-Map:
`E (U, V, Z, W) = sum (2, 3 , 6, 8, 9, 10, 11 , 12 , 13 )`
Concept: Use of Karnaugh Map for Minimization of Boolean Expressions (Up to 4 Variables)
Verify the following using Boolean Laws : U'+V = U'V'+ U' .V + U.V
Concept: Commutative Law
Draw the Logic Circuit for the following Boolean Expression: (X'+Y).Z + W'
Concept: Application of Boolean Logic - Digital Electronic Circuit Design Using Basic Logic Gates (NOT, AND, OR, NAND, NOR)
Derive a Canonical POS expression for a Boolean function F, represented by the following truth table
| P | Q | R | F(P,Q,R) |
| 0 | 0 | 0 | 1 |
| 0 | 0 | 1 | 0 |
| 0 | 1 | 0 | 0 |
| 0 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 |
| 1 | 0 | 1 | 0 |
| 1 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 |
Concept: Obtaining Sum of Product (SOP) and Product of Sum (POS) Form the Truth Table
Reduce the following Boolean Expression to its simplest form using K-Map
`F (X, Y, Z, W) = sum (0, 1, 4, 5, 6, 7, 8, 9, 11, 15)`
Concept: Use of Karnaugh Map for Minimization of Boolean Expressions (Up to 4 Variables)
