Beruflich Dokumente
Kultur Dokumente
INTERNET APPLICATION
(03110257)
Laboratory Manual
KUNTAL SHUKLA
Bachelor of Technology
(AGRICULTURAL)
FACULTY OF ENGINEERING AND TECHNOLOGY
AGRICULTURAL
PREFACE
It gives us immense pleasure to present the first edition of
Database Management & Internet Application Laboratory
Practical Book for the B.Tech.-2 nd year students of PARUL
UNIVERSITY.
KUNTAL SHUKLA
DATABASE MANAGEMENT & INTERNET APPLICATION
Page 4
FACULTY OF ENGINEERING AND TECHNOLOGY
AGRICULTURAL
Table of Contents
EXPERIMENT NO. 1.........................................................................................................7
AIM: Basic Database Concepts.................................................................7
EXPERIMENT NO. 2.......................................................................................................14
AIM: Introduction to RDBMS...................................................................14
EXPERIMENT NO. 3.......................................................................................................20
AIM: S Q L C o m m a n d s D D L , D M L .....................................................20
EXPERIMENT NO. 4.......................................................................................................26
AIM: Select Command, Joins and functions. .
..26
EXPERIMENT NO. 5.......................................................................................................31
AIM: Group functions, set functions........................................................31
EXPERIMENT NO. 6.......................................................................................................35
AIM: Working with Forms........................................................................35
EXPERIMENT NO. 7.......................................................................................................37
AIM: Basic of HTML ................................................................................37
EXPERIMENT NO. 8.......................................................................................................39
AIM: Development of Web pages using Mata tags.................................39
EXPERIMENT NO. 9.......................................................................................................41
AIM: Dynamic pages using Java Scripts..................................................41
EXPERIMENT NO. 10....................................................................................................42
AIM: Connectivity of Web pages with databases....................................42
EXPERIMENT NO. 1
AIM: To study Basic Database Concepts.
DATABASE--- An organized collection of related information.)
DEFINATION
The database system must ensure the safety of the information stored .
INFORMATION
This is a processed from of data.
It is always meaningful.
Meaningful data is called information.
It is output processing units.
When ever we organize the data and process is done on it then we
get proper information.
Example :-
NO. BRANCH STUDENT
1 CE 60
2 EC 50
METADATA
Files
Database
A database is a collection of persistent data that is used by application
systems of some given enterprise.
Persistent means the data is not transient in nature like input and
output data.
In short database is collection of data.
Database can be define by meaningful data
An organized collection of logically related data.
Database system
Database system is basically computerized record keeping system,
whose overall purpose is to maintain information and to make that
information available on demand Four components of database system.
Data
Hardware
Software
User
Data
Database system is available on small systems as well as large
systems. Small systems are single user system on which at most
one user can access the data at any given time. Large systems
are usually multi-user systems on which multiple users can
access the data concurrently. Data in the database of multi-user
system must be integrated and shared.
Integrated - The data files available in the database system must
have redundancy among them wholly or partially removed so
that they are same at all the location.
Shared - The individual piece of data in the database can be
shared among several different users.
Hardware
The hardware system consist of : Secondary storage volumes -
typically moving - head magnetic disks - that are used to hold
data, together with the associated I/O devices.
Processor and main memory they support the execution of
database system software.
Software
Software is a collection of a program.
It is the layer between the physical database itself and the users
called database manager or more usually database management
system. It shields the users of database from hardware level
details.
Users
Application programmers
Sophisticated users
Specialized users
Nave users
Nave users: They are unsophisticated users who interact with the
system by invoking one of the permanent application programs that have
been written previously.
Operations performed on database systems.
Database administrator
One of the main reasons for using DBMS is to have central control of
both of data and programs that access those data.
DATABASE MANAGEMENT & INTERNET APPLICATION
Page 12
FACULTY OF ENGINEERING AND TECHNOLOGY
AGRICULTURAL
A person who has such central control over the system is called
database administrator.
The functions of DBA include:
Schema definition: The DBA creates the original database
schema by executing a set of data definition statements in DDL
(data-definition language).
REVIEW QUESTION
1) EXPLAIN DATA, INFORMATION, METADATA, SYSTEM CATLOG.
2) DIFFERENCES BETWEEN DATA VS INFORMATION.
3) DIFFERENCES BETWEEN FILE ORIENTED SYSTEM VS DATABASE
SYSTEM.
4) EXPLAIN DATA ADMINISTRATOR.
5) EXPLAIN DATABASE ADMINISTRATOR.
6) EXPLAIN DATA DICTIONARY.
7) ADVANTAGE AND DISADVANTAGE OF DBMS.
8) ADVANTAGE AND DISADVANTAGE OF FILE-ORIENTED SYSTEM.
9) EXPLAIN DATA APPROACH.
10) EXPLAIN DATA BASE.
11) EXPLAIN DATA BASE SYSTEM
EXPERIMENT NO. 2
AIM: Introduction to RDBMS.
Introduction
Domain:
Keys of Relations
Super Key
"A super key is a set of one or more attributes that allows to
identify each tuple
uniquely in a relation."
For example, consider a relation Customer with attributes
cid, cname, address,
and contact_no.
In this relation, each tuple represents an individual customer.
Here, the cid attribute can distinguish each tuple from
another. So, cid is a super key for Customer relation.
Relation Key
"A super key for which no subset is a super key is
called a relation key."
There can be more than one relation keys for the same
relation. For example, for Customer relation, {cid} as
well as {cname, address} are relation keys.
Candidate Key
"If a relation contains more than one relation keys, then,
they each are called candidate key."
Primary Key
"A primary key is a candidate key that is chosen by the
database designer to identify tuples uniquely in a
relation."
Alternate Key
"An alternate key is a candidate key that is not chosen by
the database designer to identify tuples uniquely in a
relation."
Foreign Key
RELATIONAL ALGEBRA
select:
project:
union:
set difference:
Cartesian product: x
Rename:
Symbol: (Sigma)
Notation: p(r)
Symbol : (pi)
STUDEN EX
T# A
M
A101 60
A101 50
J326 70
EXPERIMENT NO. 3
AIM: SQL Commands DDL, DML
a. Create
b. Insert.
DATABASE MANAGEMENT & INTERNET APPLICATION
Page 20
FACULTY OF ENGINEERING AND TECHNOLOGY
AGRICULTURAL
c. Select
d. Delete
e. Update
f. Drop
g. Truncate
a. Create
mysql> create database my_database;
Database changed
+--------+-----+-----+
+--------+-----+-----+
| 1| 6| 0|
+--------+-----+-----+
+--------+-----+-----+
+--------+-----+-----+
| 1 | 6.3 | 0|
+--------+-----+-----+
+--------+-----+
| sem_no | spi |
+--------+-----+
| 1 | 6.3 |
+--------+-----+
INSERT
mysql> insert into BE_academic values(2,6.30);
+--------+-----+
| sem_no | spi |
+--------+-----+
| 1 | 6.3 |
| 2 | 6.3 |
| 3 | 7.2 |
| 4 | 8.5 |
| 5 | 8.9 |
| 6| 9|
| 7 | 9.3 |
| 8 | 9.9 |
+--------+-----+
DELETE
mysql> delete from BE_academic where spi = 9;
+--------+-----+
| sem_no | spi |
+--------+-----+
| 1 | 6.3 |
| 2 | 6.3 |
| 3 | 7.2 |
| 4 | 8.5 |
| 5 | 8.9 |
| 7 | 9.3 |
| 8 | 9.9 |
+--------+-----+
+--------+-----+
| sem_no | spi |
+--------+-----+
| 1 | 6.3 |
| 2 | 6.3 |
| 3 | 7.2 |
| 4 | 8.5 |
| 5 | 8.9 |
| 6 | 9.1 |
| 7 | 9.3 |
| 8 | 9.9 |
+--------+-----+
TRUNCATE
mysql> truncate BE_academic;
EXPERIMENT - 4
PROGRAM:
Equi Join :
A join based on an exact match between two columns is called an
Equi Join
The comparison operator in the join condition is =
Example:
The above join query will retrieve the name, id and location of all
employees
Output:
Ename Eid Location
Rahul E01 Mumbai
Vishal E02 Chennai
Ajit E03 Mumbai
Non-Equi Join :
Joins which use comparison operators other than = are called
Non-Equi joins.
Example:
Self Join :
A join that joins one row in table with another row in the same
table is called Self Join.
Using the table alias names these two identical tables can be
joined.
From <TableName> [<alias1>], <TableName> [<alias2>]
Example:
Table Name: employee
The above query will retrieve the names of the employees and
the names of their respective manager from the employee table
Output:
Ename Manager_
no
Rahul Vishal
Vishal Ronak
Ajit Prem
Outer Join :
Outer join in three types
Left outer join
Right outer join
Full outer join
Name Id
------------- -----------
Rahul 10
Vishal 20
Id City
------------- -----------
30 bombay
20 madras
40 bombay
OUTPUT:-
NAME ID ID CITY
---------- ------ ------ --------
vishal 20 20 madras
rahul 10
OUTPUT:-
NAME ID ID CITY
---------- ------ ------ --------
vishal 20 20 madras
30 bombay
40 bombay
OUTPUT:-
NAME ID ID CITY
---------- ------ ------ --------
vishal 20 20 madras
rahul 10
30 bombay
40 bombay
EXPERIMENT - 5
PROGRAM:
SET OPERATIONS
UNION, INTERSECT, MINUS
UNION Clause
The UNION clause merges or combines the output of two or more
queries into a single set of rows and columns
Multiple queries can be put together and their output combined
using the UNION clause.
Example:
Table Name: client_master
y
S00002 Manish Delhi
S00003 Ravi Bomba
y
OUTPUT:
ID Name
C00001 Ivan bayross
C00003 Pramala
S00001 Kiran
S00003 Ravi
INTERSECT Clause
The INTERSECT clause outputs only those rows produced by both
queries intersected.
The output of INTERSECT clause will include only those rows that
are retrieved by both the queries.
Output:
Sman_no name
S00001 Kiran
S00003 Ravi
MINUS Clause
The MINUS clause outputs the rows produced by the first query,
after filtering the rows retrieved by the second query.
Order_no product_no
O19001 P00001
O19001 P00004
O19001 P00006
O19002 P00002
O19002 P00005
O19003 P00003
O19004 P00001
O19005 P00006
O19005 P00004
O19006 P00006
Product_no Description
P00001 1.44 floppies
P00002 Monitors
P00003 Mouse
P00004 1.22 floppies
P00005 Keyboards
P00006 CD drive
P00007 HDD
P00008 1.44 drive
P00009 1.22 drive
MINUS
Select product_no from sales_order_details;
Output:
Product_no
P00007
P00008
P00009
EXPERIMENT NO. 6
AIM: WORKING WITH FORMS
PROGRAM:
Text Input
<form>
First name:<br>
<input type="text" name="firstname"><br>
Last name:<br>
<input type="text" name="lastname">
</form>
<form>
<input type="radio" name="gender" value="male" checked> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other
</form>
Last name:<br>
The action attribute defines the action to be performed when the form is
submitted.
Normally, the form data is sent to a web page on the server when the user
clicks on the submit button.
In the example above, the form data is sent to a page on the server called
"action_page.php". This page contains a server-side script that handles
the form data:
<form action="action_page.php">
If the action attribute is omitted, the action is set to the current page.
EXPERIMENT NO. 7
AIM: Basics of HTML
PROGRAM:
HTML Document:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
HTML Headings:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
HTML Paragraphs:
<!DOCTYPE html>
<html>
<body>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
</body>
</html>
HTML Links:
<!DOCTYPE html>
<html>
<body>
</body>
</html>
HTML Images
<!DOCTYPE html>
<html>
<body>
</body>
</html>
EXPERIMENT NO. 8
THEORY:
HTML lets you specify metadata - additional important information about a
document in a variety of ways. The META elements can be used to include
name/value pairs describing properties of the HTML document, such as
author, expiry date, a list of keywords, document author etc.
The <meta> tag is used to provide such additional information. This tag
is an empty element and so does not have a closing tag but it carries
information within its attributes.
PROGRAM:
Adding HTML meta tag, metadata as an important keyword
Use of <meta> tag to give information about when last time the
document was updated
EXPERIMENT NO. 9
AIM: Dynamic pages using Java Scripts
PROGRAM:
Create a Web page that customized itself by asking the user their name and then
incorporating that name within the text of the page.
<html>
<!-- Dave Reed greet.html 1/20/02 -->
<!-- -->
<!-- Web page that displays a personalized greeting. -->
<!------------------------------------------------------>
<head>
<title> Greetings </title>
</head>
<body>
<script language="JavaScript">
firstName = prompt("Please enter your name", "");
<p>
Whatever else you want to appear in your Web page...
</body>
</html>
OUTPUT:
EXPERIMENT: 10
DATABASE MANAGEMENT & INTERNET APPLICATION
Page 43
FACULTY OF ENGINEERING AND TECHNOLOGY
AGRICULTURAL
PROGRAM:
Displaying Data from Database
Create a database
Add data to the database
Creating a Database
WebMatrix will create a database with the same name as your site:
"Demo.sdf":
For the "Id" column, Set Data Type to "bigint", Is Primary Key to "Yes",
and Is Identity to "Yes".
When you are finished, your table design will look like this
Is Primary Key?, tells the database that this will be the table's primary
key.
Open the Products table (In the left pane, double-click SmallBakery.sdf,
double-click Tables, and double-click Products).
Name Description
After you have finished your input, your screen should look much like this: