Thursday, 18 October 2012

JSP

server...

If you do not have a JSP capable web-server or application server, the first step is to download one.  There are many such servers available, most of which can be downloaded for free evaluation and/or development.  Some of them are:

Blazix from Desiderata Software (1.5 Megabytes, JSP, Servlets and EJBs)
TomCat from Apache (Approx 6 Megabytes)
WebLogic from BEA Systems (Approx 40 Megabytes, JSP, Servlets and EJBs)
WebSphere from IBM (Approx 100 Megabytes, JSP, Servlets and EJBs)

 

ALL DBMS PPTS

http://www.cse.iitb.ac.in/~sudarsha/db-book/slide-dir/index.html

JDBC CODE

import java.sql.*;
import javax.sql.*;

public class jdbcdemo{

public static void main(String args[]){
String dbtime;
String dbUrl = "jdbc:mysql://localhost:3306/raju";
String dbClass = "com.mysql.jdbc.Driver";
String query = "Select * FROM users";
String USER = "root";
String PASS = "";

try {

Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection (dbUrl,USER,PASS);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);

while (rs.next()) {
dbtime = rs.getString(1);
System.out.println(dbtime);
} //end while

con.close();
} //end try

catch(ClassNotFoundException e) {
e.printStackTrace();
}

catch(SQLException e) {
e.printStackTrace();
}

}  //end main

}  //end class

Saturday, 8 September 2012

Thursday, 6 September 2012

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.