Table: Book - e-CTLT

advertisement
LESSON PLAN
DATE
CLASS
XII
SUBJECT
Computer Science
1st July- 31st July
TOTAL WORKING DAYS
TOPIC
Introduction to Databases.
SUB-TOPIC
1. Database Management System.
2. SQL
GENERAL AIM
To introduce the concept of Databases and their applications.
SPECIFIC AIMS
Students must have an understanding of data, information, records and various methods of storing data .They must know about
DBMS and how it manages data and how can we store data in form of tables and what is queries and writing them. Also, they
must learn about various database objects.
TEACHING OBJECTIVES
Students must have an understanding of data, information, records and various methods of storing data .They must know about
DBMS and how it manages data and how can we store data in form of tables and what is queries and writing them. Also , they
must learn about various database objects.
PREVIOUS KNOWLEDGE
Students must know the meaning of various terms such as data, information, queries and various ways of storing data. They
should know limitations of manual system of storing data and advantages of computerized data storage mechanism.
1
TEACHER’S ACTIVITY
1) What is Data?
2) How data is different from information.
3) What is DBMS?
4) What are various examples of DBMS?
5) In how many ways we can store data?
6) What are drawbacks of Manual storage of data?
7) What are advantages of computerized storage of data?
8) What is Database?
9) What is Record?
10) What is Table?
PUPIL’S ACTIVITY
Children concepts should be analyzed on the basis of the answers they give. Accordingly we will take up the topic.
ANNOUNCEMENT OF TOPIC
Database Management System and SQL.
INTRODUCTION
Relational data model: Concept of domain, tuple, relation, key, primary key, alternate key, candidate key; General Concepts: Advantages of using
SQL, Data Definition Language and Data Manipulation Language; Data types: NUMBER, CHARACTER, DATE SQL commands:
CREATE TABLE, DROP TABLE, ALTER TABLE, UPDATE...SET..., INSERT, DELETE;SELECT, DISTINCT, FROM, WHERE,
IN,BETWEEN, GROUP BY, HAVING, ORDER BY;SQL functions: SUM, AVG, COUNT, MAX and MIN;
Obtaining results (SELECT query) from 2 tables using equi-join, Cartesian product and union
TEACHING METHOD
Lecture method followed by Practical Interactive Method.
2
TEACHING AIDS
Markers, Computers, Black-Board, Chalk, PowerPoint Presentation.
TEACHING
POINT
What is Data?
TEACHER’S ACTIVITY
PUPIL’S ACTIVITY
Students will be explained about data by
illustrating example there by giving students an
investigatory project to collect data from various
sources.
Students will complete the project and thereby
they will know how to collect data using various
methods, various sources of data i.e. Primary and
Secondary, also they will have better
understanding about data.
Project will help students to understand the
collection, storage and data representation
mechanism. They will be able to solve queries
and thus they will understand about queries and
will be able to differentiate between data and
information.
Students will be able to understand concept of
Data Abstraction through three schema
architecture of DBMS.
What
is Project will given to students to represent data in
Information?
various forms such as tabular from, using graphs
etc. and will be asked them to solve various
queries based on data collected by the students.
Three schema The concept of three layer architecture of Data
Architecture
Base Management system will be introduced and
concept of schema and instance will be
explained.
Languages used Various types if languages used in DBMS will Students will be able to write proper queries
IN DBMS
be explained to user along with their proper based on the syntax.
1) DDL
syntax and will be ensured that students must be
2) DML
able to write proper queries.
3) TCL
4) VDL
5) SDL
6) SQL
3
BLACK BOARD
SUMMARY
Various examples of data
and their storage methods
will be explained to
students
by
taking
examples.
Syntax of DDL and DML
statements will be written
and explained.
Various SQL commands
will be explained to
students.
Students will be asked to
write
the
queries
explained earlier.
RECAPITULATION
1.
2.
3.
4.
5.
Data is raw facts and figures whereas information is processed data.
Database is collection of data, table.
DBMS is system software meant for managing databases.
DBMS follows three schema architecture.
Various languages used in DBMS are:
DDL, DML, SDL, VDL, TCL, SQL
EVALUATION TOOLS
Q1) What is foreign Key? What is its purpose?
Q2) Define the terms Tuple and Attribute?
Q3) What do you understand by the terms Cardinality and Degree of the table?
Q4) What is the main function of DBA.
Q5) Write a query on the customers table whose output will exclude all customers with a rating <=100, unless they are located in Shimla.
Q6) Write a query that selects all orders except those zeros or NULLs in the amount field.
Q7) Write a query that lists customers in descending order of rating. Output the rating field first, followed by the customer’s name and number.
Q8) What are DDL and DML?
Q9) What is the difference between Where and Having Clause?
Q10) What do you understand by constraints ?
HOME-ASSIGNMENT
SLOW –LEARNER STUDENT
Q1) What do you understand by Primary Key? What are the properties of Primary key?
Q2) What do you understand by Candidate Key?
Q3) What do you understand by Alternate Key?
Q4) What do you understand by Foreign Key?
Q5) What is Domain Constraint/
Q6) What is Referential Integrity Constraint?
4
AVERAGE STUDENT
Q1) What are the compatibility criteria of Union operation?
Q2) What is Entity Integrity Constraint?
Q3) What is Degree and cardinality of relation?
Q4) What are group Functions?
Q5) Write the SQL query commands based on following table
Table: Book
Book_id Book name
C0001
Fast Cook
Publisher
EPB
Price
355
Type
Quantity
Cookery 5
F0001
First Publi.
650
Fiction
20
FPB
350
Text
10
TDH
First Publ.
350
750
Text
Fiction
15
50
T0001
T0002
F0002
Author_name
Lata Kapoor
William
The Tears
Hopkins
Brain
&
My First c++
Brooke
C++
Brain A.W.
works
Rossaine
Thunderbolts
Anna Roberts
Table: issued
Book_Id
T0001
C0001
F0001
Quantity Issued
4
5
2
Write SQL query for (a) to (f)
(a) To show book name, Author name and price of books of First Pub. Publisher
(b) To list the names from books of text type
(c) To Display the names and price from books in ascending order of their prices.
(d) To increase the price of all books of EPB publishers by 50.
(e) To display the Book_Id, Book_name and quantity issued for all books which have been issued
(f) To insert a new row in the table issued having the following data. ‘F0003’, 1
(g) Give the output of the following
1. Select Count(*) from Books
2. Select Max(Price) from books where quantity >=15
3. Select book_name, author_name from books where publishers=’first publ.’
5
4. Select count(distinct publishers) from books where Price>=400.
Bright Students
Q1) . Table: Employees
Empid
Firstname
Lastname
Address
City
010
105
152
215
244
300
335
400
441
Ravi
Harry
Sam
Sarah
Manila
Robert
Ritu
Rachel
Peter
Kumar
Waltor
Tones
Ackerman
Sengupta
Samuel
Tondon
Lee
Thompson
Raj nagar
Gandhi nagar
33 Elm St.
440 U.S. 110
24Friends street
9 Fifth Cross
Shastri Nagar
121 Harrison St.
11 Red Road
GZB
GZB
Paris
Upton
New Delhi
Washington
GZB
New York
Paris
Table: EmpSalary
Empid
Salary
Benefits
Designation
010
105
152
215
244
300
335
400
441
75000
65000
80000
75000
50000
45000
40000
32000
28000
15000
15000
25000
12500
12000
10000
10000
7500
7500
Manager
Manager
Director
Manager
Clerk
Clerk
Clerk
Salesman
salesman
Write the SQL commands for the following :
(i)
To show firstname,lastname,address and city of all employees living in paris
(ii)
To display the content of Employees table in descending order of Firstname.
(iii) To display the firstname,lastname and total salary of all managers from the tables Employee and empsalary , where total salary is calculated as
salary+benefits.
(iv)
To display the maximum salary among managers and clerks from the table Empsalary.
(v)
Give the Output of following SQL commands:
(i)
(ii)
(iii)
(iv)
Q2)
Select firstname,salary from employees ,empsalary where designation = ‘Salesman’ and Employees.empid=Empsalary.empid;
Select count(distinct designation) from empsalary;
Select designation, sum(salary) from empsalary group by designation having count(*) >2;
Select sum(benefits) from empsalary where designation =’Clerk’;
TABLE: GRADUATE
6
(a)
(b)
(c.)
(d)
(e)
S.NO
NAME
STIPEND
SUBJECT
AVERAGE
DIV.
1
2
3
4
5
6
7
8
9
10
KARAN
DIWAKAR
DIVYA
REKHA
ARJUN
SABINA
JOHN
ROBERT
RUBINA
VIKAS
400
450
300
350
500
400
250
450
500
400
PHYSICS
COMP. Sc.
CHEMISTRY
PHYSICS
MATHS
CEHMISTRY
PHYSICS
MATHS
COMP. Sc.
MATHS
68
68
62
63
70
55
64
68
62
57
I
I
I
I
I
II
I
I
I
II
List the names of those students who have obtained DIV I sorted by NAME.
Display a report, listing NAME, STIPEND, SUBJECT and amount of stipend received in a year assuming that the STIPEND is paid every month.
To count the number of students who are either PHYSICS or COMPUTER SC graduates.
To insert a new row in the GRADUATE table:
11,”KAJOL”, 300, “COMP. SC.”, 75, 1
Give the output of following sql statement based on table GRADUATE:
(i)
Select MIN(AVERAGE) from GRADUATE where SUBJECT=”PHYSICS”;
(ii)
Select SUM(STIPEND) from GRADUATE WHERE div=2;
(iii)
Select AVG(STIPEND) from GRADUATE where AVERAGE>=65;
(iv)
Select COUNT(distinct SUBDJECT) from GRADUATE;
Assume that there is one more table GUIDE in the database as shown below:
Table: GUIDE
MAINAREA
PHYSICS
COMPUTER SC
CHEMISTRY
MATHEMATICS
(f)
ADVISOR
VINOD
ALOK
RAJAN
MAHESH
What will be the output of the following query?
SELECT NAME, ADVISOR FROM GRADUATE, GUIDE WHERE SUBJECT= MAINAREA;
Teacher’s Signature
Principal’s Signature
7
Download