Wednesday, 1 August 2012

Experiment 1 solution

Q. 1 Write a sql query to create and display students table.
create table students (sid varchar(10),name varchar(20),login varchar(10),age numeric(2),gpa numeric(4,2));
Q.2Write a sql query to create and display faculty table.
create table faculty(fid varchar(10),fname varchar(20),sal numeric(8,2));
Q.3 Write a sql query to create and display courses table.
 create table courses(cid varchar(10),cname varchar(20),credits numeric(1));
Q.4 Write a sql query to create and display rooms table.
create table rooms(rno numeric(4),address varchar(20),capacity numeric(3));

Q.5  Write a sql query to create and display enrolled table.
create table enrolled(sid varchar(10),cid varchar(10),grade varchar(1) );
Q.6  Write a sql query to create and display teaches table.
create table teaches(fid varchar(10),cid varchar(10) );
Q.7 Write a sql query to create and display meet_in table.
create table meet_in(cid varchar(10),rno numeric(4),time varchar(8));
  
     Alter table add/modify/drop columns:

Q.8 write a sql query to drop a column of a table
alter table faculty drop column fname;
Q.9 write a sql query to add a column to a table
alter table faculty add fname varchar(20);
Q.10 Write a sql table to modify the columns to add null constraint.  
(EXPLANATION-A not-null constraint is always written as a column constraint. A not-null constraint is functionally equivalent to creating a check constraint CHECK (column_name IS NOT NULL), but in PostgreSQL creating an explicit not-null constraint is more efficient. The drawback is that you cannot give explicit names to not-null constraints created this way.)

alter table students ADD CONSTRAINT stud_login_nn  CHECK (login IS NOT NULL);   OR
alter table students alter column login set not null;OR
alter table students alter login set not null;

alter table faculty alter fname set  not null , alter sal set not null;   OR
alter table faculty ADD CONSTRAINT faculty_fname_nn  CHECK (fname IS NOT NULL),ADD CONSTRAINT  faculty_sal_nn  cHECK (sal IS NOT NULL);

alter table courses ADD CONSTRAINT course_cname_nn  cHECK (cname IS NOT NULL),ADD CONSTRAINT  course_credits_nn  cHECK (credits IS NOT NULL); OR
alter table courses alter cname set  not null , alter credits set not null; 

alter table rooms ADD CONSTRAINT crooms_address_nn CHECK (address IS NOT NULL),ADD CONSTRAINT  courses_capacity_nn cHECK (capacity IS NOT NULL); OR
alter table rooms alter address set  not null , alter capacity set not null;


Q.11 write a sql query to add column and table level constraints 
alter table students add constraint student_sid_pk primary key(sid), add constraint stud_login_uk unique(login);
alter table faculty add constraint faculty_fid_pk primary key(fid);
alter table courses add constraint courses_cid_pk primary key(cid);
alter table rooms add constraint rooms_rno_pk primary key(rno);
alter table enrolled add constraint enroll_grade_ck check(grade in( 'A','B','C','D'));
alter table enrolled add constraint enroll_pk primary key(sid,cid), add constraint enroll_sid_fk foreign key(sid) references  students(sid) on delete cascade,add constraint enroll_cid_fk foreign key(cid) references courses(cid);
alter table teaches add constraint teach_pk primary key(fid,cid), add constraint teach_fid_fk foreign key(fid) references faculty(fid) on delete cascade ,add constraint teach_cid_fk foreign key(cid) references courses(cid);
alter table meet_in add constraint meet_in_pk primary key(cid,rno,time), add constraint meet_in_cid_fk foreign key(cid)  references courses(cid) on delete cascade,add constraint meet_in_rno_fk foreign key(rno) references rooms(rno) on delete cascade;
(EXPLANATION-A foreign key with a cascade delete means that if a record in the parent table is deleted, then the corresponding records in the child table with automatically be deleted. This is called a cascade delete.)

ER Model to Relational Model Maping

Lecture Series on Database Management System by Dr.S.Srinath, IIIT Bangalore. For more details on NPTEL visit http://nptel.iitm.ac.in

Data Modelling - ER Diagrams, Mapping


Lecture Series on Software Engineering by Prof.N.L. Sarda, Prof. Umesh Bellur,Prof.R.K.Joshi and Prof.Shashi Kelkar, Department of Computer Science & Engineering ,IIT Bombay . For more details on NPTEL visit http://nptel.iitm.ac.in

Introduction of DBMS

Lecture Series on Database Management System by Prof.D.Janakiram, Department of Computer Science & Engineering ,IIT Madras. For more details on NPTEL visit http://nptel.iitm.ac.in

Tuesday, 31 July 2012

neural network Question bank 1

A. supervised learning, and unsupervised learning.
B. Hebbian Learning Rule 

1. what is supervised learning? with a neat diagram and an example.
2. What is unsupervised learning? with a neat diagram and an example.
3. differentiate between  supervised learning and unsupervised learning.
4. Explain  Hebbian Learning with a neat diagram and an example.


Answer (1,2,3,4)

http://www.uotechnology.edu.iq/dep-eee/lectures/4th/Electronic/Software%20&%20intelligent%20system/1.pdf

Monday, 30 July 2012

ER Model vs. Relational Model


• Both are used to model data
• ER model has many concepts
– entities, relations, attributes, etc.
– well-suited for capturing the app. requirements
– not well-suited for computer implementation
– (does not even have operations on its structures)
• Relational model
– has just a single concept: relation
– world is represented with a collection of tables
– well-suited for defining manipulations on data

Experiment 2



 
Reference and source:- Database Management Systems”, by Raghu Ramakrishnan & Johannes Gehrke,   third edition, McGraw-Hill, 2003.
Please refer above book for details 
Part 1:-
A university DB contains information about professors (identified by social security number, or SSN) and courses (identified by courseid). Professors teach courses; each of the following situations concerns the Teachers relationship set. For each situation, draw an ER diagram that describes it (assuming no further constraints hold).
  • Professors can teach the same course in several semesters, and each ofering must be recorded.
  • Professors can teach the same course in several semesters, and only the most recent such offering needs to be recorded. (Assume this condition applies in all subsequent questions.)
  • Every professor must teach some course.
  • Every professor teaches exactly one course.
  • Every professor teaches exactly one course, and every course must be taught by some professor.
  • Now suppose that certain courses can be taught by a team of professors jointly, but it is possible that no one professor in a team can teach the course.
 Part 2:- 
Design and draw ER diagram capturing all the following constraints regarding an university DB:
  • Professors have an SSN, a name, an age, a rank, and a research specialty.
  • Projects have a project number, a sponsor name, a starting date, an ending date, and a budget.
  • Graduate students have an SSN, a name, an age, and a degree program (M.S. or Ph.D.)
  • Each project is managed by one professor (known as the project’s principal investigator).
  • Each project is worked on by one or more professors (known as the project’s co-investigators).
  • Professors can manage and/or work on multiple projects.
  • Each project is worked on by one or more graduate students (the project’s research assistants). 
  • When grad. students work on a project, a professor must supervise their work on the project. Grad. Students may work on many projects (in this case they may have more than one supervisor). 
  • Departments have a department number, name, and a main office. 
  • Departments have a professor, who runs the department. 
  • Professors work in one or more departments, and for each department that they work in, a time percentage is associated with their job. 
  • Grad. students have one major department in which they are working on their degree. 
  • Each grad. Student has another, more senior grad. student (a student advisor) who advises him/her on what courses to take. 

Sunday, 29 July 2012

Thursday, 26 July 2012

question Bank UNIT I dbms

1. What are database systems? List out its characteristics.
2. What are logical levels is used in data abstraction?
3. Define data, database, DBMS and data base system.
4. Define DBMS.
5. What is meant by data abstraction?
6. Distinguish between physical and logical data independence.
7. What do you understand by data independence? How can it be achieved?
8. What are the data models present in DBMS?
9. What is a data dictionary? What are the information’s stored in the data dictionary?
10. What are the benefits of data dictionary? Who are the users of data dictionary?
11. What is meant by an Instance of the database and schema?
12. Explain briefly about E-R data model.
13. What is the purpose of Meta data?
14. Define the terms: (a) meta data (b)Canned transaction
15. What are the problems in data redundancy?
16. What is the purpose of buffer manager?
17. Define the term Atomicity in transaction management.
18. What are the characteristics that distinguish a DBMS from traditional file processing system?
19. What is the purpose of transaction manager?
20. List out the functions of DBA.Explain.
21. Who are all the database users present in DBMS?Give role of each.
22. Describe the different types of database end users.
23.Define database schema.
24.What are the different database languages?Explain.
25.What is the need for Normalisation ?
26.What is a referential integrity?
27.What is logical data independence and why is it important?
28.What is the difference between physical data independence and logical data independence?
29.  What is Physical data independence?
30.Differentiate between XML and HTML.
31.Explain Semi-structured data model with an example.
33.What is object relational data model?
34.What is difference between object oriented data model and object relational data model?
35.What is difference between machine learning and data mining?
36.What is KDD?
37.Differentiate between KDD and Data Mining.
38.What is market basket analysis?
39.What is association rule mining?Give an example.
40.Describe the structure of a DBMS.
41.What do you mean by a data model?
  Describe the different types of data models used.
42.Describe the main components of a DBMS.
43.Discuss the advantages and characteristics of the three-tier-architecture.
44.Compare the two-tier and three-tier client server architecture.
45.Why null values are introduced in the database?
46.What is meant by the term client/server architecture and what are the advantagesand disadvantages of this approach?
47.Consider the following relational schema
Account (account-number, branch-name, balance)
Loan (Loan-number, branch-name, balance)
Depositor (Customer-name, Account-number)Borrower (Customer-name, Loan-number)
Write queries in SQL for the following:
(a)Find all loan numbers for loan made at Bombay branch.
(b)Find all customers who have both a loan and an account at the bank.
(c)Find the average account balance at each branch.
(d)Find the number of depositors at each branch.
48.What is data mining?
49.What is data warehouse?
50.List four significant differences between a file-processing system and a DBMS.
51.Describe a circumstance in which you would choose to use embedded SQL rather than using SQL alone.
52.What is meant by an entity, attributes, entity set and relationship ?
53.How is E-R data model useful ?
54.Give example of following relationships :
(i) Many-to-One
(ii) One-to-One
(iii)One-to-Many
(iv) Many-to-Many
55.What do you mean by redundancy ?How this can be avoided ?
56.What is the difference between Procedural DML and Non-Procedural DML ?
57.What do you mean by instance & schema ? Explain the difference between these.
58.What is the role of three levels of Data Abstraction ?
59.Give SQL statement which creates a STUDENT table consisting of following fields.
Name CHAR(40)
Class CHAR(6)
Marks NUMBER(4)
Rank CHAR(8)
60.Explain the type of relationship the following have :
Student and ID card
Customer and Bank
Student and Roll No
Customer and Car
61.Differentiate between SQL commands DROP TABLE and DROP VIEW.
62.Is Data Dictionary an essential part of DBMS. Why ?
63.What do you mean by integrity constraints ?give example.
64.Explain the term Distributed DBMS and Client-Server DBMS
65.What is query processing .explain the various steps involved in it.
66. Explain the four types of mapping cardinality with example.
67.Define the terms 1) physical schema 2) logical schema



A List of Database Management Systems

DBMS Vendor Type Primary Market
Access (Jet, MSDE) Microsoft R Desktop
Adabas D Software AG R Enterprise
Adaptive Server Anywhere Sybase R Mobile/Embedded
Adaptive Server Enterprise Sybase R Enterprise
Advantage Database Server Extended Systems R Mobile/Enterprise
Datacom Computer Associates R Enterprise
DB2 Everyplace IBM R Mobile
Filemaker FileMaker Inc. R Desktop
IDMS Computer Associates R Enterprise
Ingres ii Computer Associates R Enterprise
Interbase Inprise (Borland) R Open Source
MySQL Freeware R Open Source
NonStop SQL Tandem R Enterprise
Pervasive.SQL 2000 (Btrieve) Pervasive Software R Embedded
Pervasive.SQL Workgroup Pervasive Software R Enterprise (Windows 32)
Progress Progress Software R Mobile/Embedded
Quadbase SQL Server Quadbase Systems, Inc. Relational Enterprise
R:Base R:Base Technologies Relational Enterprise
Rdb Oracle R Enterprise
Red Brick Informix (Red Brick) R Enterprise (Data Warehousing)
SQL Server Microsoft R Enterprise
SQLBase Centura Software R Mobile/Embedded
SUPRA Cincom R Enterprise
Teradata NCR R VLDB (Data Warehousing)
YARD-SQL YARD Software Ltd. R Enterprise
TimesTen TimesTen Performance Software R In-Memory
Adabas Software AG XR Enterprise
Model 204 Computer Corporation of America XR VLDB
UniData Informix (Ardent) XR Enterprise
UniVerse Informix (Ardent) XR Enterprise
Cache' InterSystems OR Enterprise
Cloudscape Informix OR Mobile/Embedded
DB2 IBM OR Enterprise/VLDB
Informix Dynamic Server 2000 Informix OR Enterprise
Informix Extended Parallel Server Informix OR VLDB (Data Warehousing)
Oracle Lite Oracle OR Mobile
Oracle 8I Oracle OR Enterprise
PointBase Embedded PointBase OR Embedded
PointBase Mobile PointBase OR Mobile
PointBase Network Server PointBase OR Enterprise
PostgreSQL Freeware OR Open Source
UniSQL Cincom OR Enterprise
Jasmine ii Computer Associates OO Enterprise
Object Store Exceleron OO Enterprise
Objectivity DB Objectivity OO VLDB (Scientific)
POET Object Server Suite Poet Software OO Enterprise
Versant Versant Corporation OO Enterprise
Raima Database Manager Centura Software RN Mobile/Embedded
Velocis Centura Software RN Enterprise/Embedded
Db.linux Centura Software RNH Open Source/Mobile/Embedded
Db.star Centura Software RNH Open Source/Mobile/Embedded
IMS DB IBM H Enterprise
 relational(R), extended-relational(X), object-relational(OR), object-oriented(OO), network(N) and hierarchical(H).
SOURCE:-http://cs.fit.edu/~pbernhar/dbms.html

Monday, 23 July 2012