Dbms Lab Manual
Dbms Lab Manual
no: 1 Create a database table, add constraints (primary key, unique, check, not null)
Date: insert rows, update and delete rows using SQL DDL and DML commands.
AIM:
To create a database table, add constraints and execute SQL DDL and DML commands.
SQL:
SQL stands for Structured Query Language. SQL is composed of commands that enable
users to create database and table structures, perform various types of data manipulation
and data administration, and query the database to extract useful information.
The language used to define the database schema is called Data Definition language.
DDL is used to create, update and drop the database views. The Commands used in DDL
are
▪ CREATE
▪ ALTER
▪ DROP
▪ TRUNCATE
▪ RENAME
Create Table:
Syntax
Alter Table:
This command is used to add or drop or modify the attributes from the existing table.
Syntax
Adding an attribute:
Dropping an attribute:
Modifying an attribute:
TRUNCATE
TRUNCATE command removes all the records from a table. But this command will not
destroy the table's structure. When we use TRUNCATE command on a table its (auto-
increment) primary key is also initialized.
RENAME
RENAME command is used to set a new name for any existing table.
DROP
This command is used to remove a relation from an SQL database. This command
deletes notonly the records of the table but also the entire schema of the database.
Syntax:
• Insert
• Select
• Update
• Delete
INSERT
Insert command is used to insert the values into the table. There are three ways to insert
a recordinto the database.
Syntax:
SELECT:
The select statement is used to query a database. This statement is used to retrieve the
information from the database. The SELECT statement can be used in many ways. They
are:
Syntax
Syntax
UPDATE:
Syntax:
UPDATE table_name
DELETE:
Syntax:
COMMANDS
create table employer(empno int (10) primary key, ename varchar(10) not null, job varchar
(10) not null, deptno int (10) unique, salary int(10), check(salary>100000));
5. Update the employer table to set the salary of all employees to Rs450000 who are
working as Manager
9. List the records in the employer table orderby salary in descending order
11. Display salary from the employer table avoiding the duplicated values
RESULT:
Thus, the creation of database and the SQL queries to retrieve information from the
database has been implemented and the output was verified.
AIM:
To create a set of tables, add foreign key constraints and incorporate referential integrity
FOREIGN KEY
A FOREIGN KEY is a field (or collection of fields) in one table, that refers to the PRIMARY
KEY in another table. The table with the foreign key is called the child table, and the table
with the primary key is called the referenced or parent table. The FOREIGN KEY constraint
prevents invalid data from being inserted into the foreign key column, because it has to be
one of the values contained in the parent table.
CREATE TABLE Persons (ID int, LastName varchar(255) NOT NULL, FirstName
varchar(255), Age int, PRIMARY KEY (ID));
2. create a FOREIGN KEY on the "PersonID" column when the "Orders" table is
created
CREATE TABLE Orders ( OrderID int NOT NULL, OrderNumber int NOT NULL, id int,
PRIMARY KEY (OrderID), FOREIGN KEY (id) REFERENCES Persons(ID));
RESULT:
Thus, the table is created with foreign key constraints and executed successfully.
AIM:
To create a database table using different “where” clause conditions and also implement
aggregate functions.
WHERE
Syntax:
The ORDER BY keyword is used to sort the result-set in ascending or descending order.
The ORDER BY keyword sorts the records in ascending order by default. To sort the records
in descending order, use the DESC keyword
Syntax:
SELECT column1, column2, ...
FROM table_name
ORDER BY column1, column2, ... ASC|DESC;
UPDATE:
The UPDATE statement is used to modify the existing records in a table.
Syntax:
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
DELETE:
The DELETE statement is used to delete existing records in a table
Syntax:
DELETE FROM table_name WHERE condition;
LIKE:
The LIKE operator is used in a WHERE clause to search for a specified pattern in a
column
Syntax:
Syntax:
The MIN() function returns the smallest value of the selected column.
The MAX() function returns the largest value of the selected column
The COUNT() function returns the number of rows that matches a specified criterion
ORDER BY
The GROUP BY statement groups rows that have the same values into summary rows, like
"find the number of customers in each country".
Syntax:
SELECT column_name(s)
FROM table_name
WHERE condition
GROUP BY column_name(s);
The HAVING clause was added to SQL because the WHERE keyword cannot be used with
aggregate functions.
Syntax:
SELECT column_name(s)
FROM table_name
WHERE condition
GROUP BY column_name(s)
HAVING condition
ORDER BY column_name(s);
Queries:
1. Create a table
Employee (empno, ename, job, deptno,salary)
2. Diplay all the details of the records whose employees name starts with “a”
select * from employee where ename like “a%”
3. Display all the details of the records whose employees name does not start
with “a”
Select * from employee where ename not like “a%”
4. Display the rows whose salary ranges from 15000 to 30000
Result:
Thus the database table is created using different ‘where’ clause conditions and also
implement aggregate functions.
AIM:
To create a database tables and implement sub queries and simple join operations.
A Subquery is a query within another SQL query and embedded within the WHERE clause.
Important Rule:
o A subquery can be placed in a number of SQL clauses like WHERE clause, FROM
clause, HAVING clause.
o You can use Subquery with SELECT, UPDATE, INSERT, DELETE statements along
with the operators like =, <, >, >=, <=, IN, BETWEEN, etc.
o A subquery is a query within another query. The outer query is known as the main
query, and the inner query is known as a subquery.
o Subqueries are on the right side of the comparison operator.
o A subquery is enclosed in parentheses.
o In the Subquery, ORDER BY command cannot be used. But GROUP BY command
can be used to perform the same function as ORDER BY command.
SELECT:
The select statement is used to query a database. This statement is used to retrieve the
information from the database. The SELECT statement can be used in many ways. They
are
Syntax:
SELECT column name FROM table_name;
Syntax:
SELECT * FROM table_name;
Syntax:
SELECT column name(s) FROM table_name
WHERE Column name
IN(value1,value2,……,value n);
BETWEEN can be used to get those items that fall within a range.
Syntax:
SELECT column name FROM table_name
WHERE Column name BETWEEN value1
AND value2;
Syntax:
Syntax:
SELECT column name FROM table_name
WHERE Condition1 LOGICAL
OPERATOR condition2;
JOIN:
SQL joins are used to query data from two or more tables, based on a relationship
between certain columns in these tables.
ON table_name1.column_name=table_name2.column_name;
Queries:
1. Creating Dept table:
mysql> create table dept(dno int(10),dname varchar(10),loc varchar(10));
Query OK, 0 rows affected, 1 warning (0.23 sec)
1. Non-Equijoin:
A join which contains an operator other than equal to ‘=’ in the join condition.
mysql> select eno,ename,job,dname,loc from emp2 e,dept d where e.dno>d.dno;
+------+---------+----------+-----------+--------+
| eno | ename | job | dname | loc |
+------+---------+----------+-----------+--------+
| 222 | sandeep | clerk | inventory | hyd |
| 444 | madhu | engineer | HR | mumbai |
| 444 | madhu | engineer | finance | bglr |
+--------+
| sname |
+--------+
| prajan |
| anand |
| ravi |
+--------+
mysql> select sname from sstud1 where sstud1.sname not in ( select sstud2.sname from
sstud2 );
+-------+
| sname |
+-------+
| kumar |
+-------+
mysql> select sname from sstud2 where marks > some(select marks from sstud2 where
dept='cse');
+--------+
+--------+
| prajan |
+--------+
mysql> select sname from sstud2 where marks >= some (select marks from sstud2
where dept='cse' );
+--------+
| sname |
+--------+
| prajan |
| vasu |
+--------+
mysql> select sname from sstud2 where marks > any ( select marks from sstud2 where
dept='cse' );
+--------+
| sname |
+--------+
| prajan |
+--------+
mysql> select sname from sstud2 where marks >= any ( select marks from sstud2 where
dept='cse' );
+--------+
+--------+
| prajan |
| vasu |
+--------+
mysql> select sname from sstud2 where marks > all ( select marks from sstud2 where
dept='cse' );
mysql> select sname from sstud2 where marks < all ( select marks from sstud2 where
dept='cse' );
+-------+
| sname |
+-------+
| anand |
| ravi |
+-------+
mysql> select sname from sstud1 where exists ( select sstud2.sname from sstud2 where
sstud1.sname=sstud2.sname );
+--------+
| sname |
+--------+
| prajan |
| ravi |
+--------+
mysql> select sname from sstud1 where not exists ( select sstud2.sname from sstud2
where sstud1.sname=sstud2.sname );
+-------+
| sname |
+-------+
| kumar |
+-------+
RESULT:
Thus, the database tables were created and explore sub queries and simple join operations.
AIM:
To create a database table and explore natural, equi and outer joins.
JOIN OPERATIONS
• INNER JOIN/ NATURAL JOIN/ JOIN: It is a binary operation that allows us to
combine certain selections and a Cartesian product into one operation.
• OUTER JOIN: It is an extension of join operation to deal with missing information.
➢ Left Outer Join: It takes tuples in the left relation that did not match with any
tuple in the right relation, pads the tuples with null values for all other attributes
from the right relation and adds them to the result of the natural join.
➢ Right Outer Join: It takes tuples in the right relation that did not match with any
tuple in the left relation, pads the tuples with null values for all other attributes
from the left relation and adds them to the result of the natural join.
➢ Full Outer Join: It combines tuples from both the left and the right relation and
pads the tuples with null values for the missing attributes and hem to the result
of the natural join.
INNER JOIN SYNTAX:
ON table_name1.column_name=table_name2.column_name;
Queries:
1. Creating Dept table:
mysql> create table dept(dno int(10),dname varchar(10),loc varchar(10));
Query OK, 0 rows affected, 1 warning (0.23 sec)
mysql> insert into dept values(10,'inventory','hyd'),(20,'finance','bglr'),(30,'HR','mumbai');
Query OK, 3 rows affected (0.07 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> select * from dept;
+------+-----------+--------+
| dno | dname | loc |
+------+-----------+--------+
Aim:
To write a program using user defined functions and stored procedures in SQL.
RESULT:
Thus, the program was created using stored procedures and functions in SQL.
AIM:
To study and execute various Data Control Language and Transaction Control Language
commands in SQL.
Procedure:
1: Start
2: Create the table with its essential attributes. 3: Insert the record into table
4: Execute the DCL commands GRANT and REVOKE
5: Execute the TCL commands COMMIT, SAVEPOINT and ROLLBACK.
6: Stop
DCL Commands.
DCL includes commands such as GRANT and REVOKE which mainly deal with the
rights, permissions, and other controls of the database system.
GRANT:
This command gives users access privileges to the database. For this first we have to create
user.
MySQL allows us to specify which user account can connect to a database server. The user
account details in MySQL contains two information – username and host from which the
user is trying to connect in the format username@host-name. If the admin user is connecting
through localhost then the user account will be admin@localhost. MySQL stores the user
account in the user grant table of the mysql database. The CREATE USER statement in
MySQL allows us to create new MySQL accounts or in other words, the CREATE USER
statement is used to create a database account that allows the user to log into the MySQL
database.
Syntax:
CREATE USER user_account IDENTIFIED BY password;
NOTE: in our system user is a@localhost
Syntax:
GRANT privileges_names ON object TO user
Parameters Used in Grant Command
privileges_name: These are the access rights or privileges granted to the user. object:It is
the name of the database object to which permissions are being granted. In the case of
granting privileges on a table, this would be the table name. user:It is the name of the user
to whom the privileges would be granted. Various privileges used are, SELECT, INSERT,
DELETE, INDEX, UPDATE, CREATE, ALTER, DROP, GRANT. 1. Granting SELECT
Privilege to a User in a Table:
To grant Select Privilege to a table named “users” where User Name is root, the following
mysql> commit;
Query OK, 0 rows affected (0.00 sec)
RESULT:
Thus the DCL and TCL commands are studied and executed successfully and output was
verified.
Aim:
To execute programs for insert, delete, and update operations in a database table using
triggers.
A MySQL trigger is a stored program (with queries) which is executed automatically to
respond to a specific event such as insertion, updation or deletion occurring in a table. In
order to create a new trigger, you use the CREATE TRIGGER statement. The following
illustrates the syntax of the CREATE TRIGGER statement:
CREATE TRIGGER trigger_name trigger_time trigger_event ON table_name FOR EACH
ROW
BEGIN
... END;
Let’s examine the syntax above in more detail.
You put the trigger name after the CREATE TRIGGER statement. The trigger name should
follow the naming convention [trigger time]_[table name]_[trigger event], for example
before_employees_update. Trigger activation time can be BEFORE or AFTER. You must
specify the activation time when you define a trigger. You use the BEFORE keyword if you
want to process action prior to the change is made on the table and AFTER if you need to
process action after the change is made. The trigger event can be INSERT, UPDATE or
DELETE. This event causes the trigger to be invoked. A trigger only can be invoked by one
event. To define a trigger that is invoked by multiple events, you have to define multiple
triggers, one for each event. A trigger must be associated with a specific table. Without a
table trigger would not exist therefore you have to specify the table name after the ON
keyword. You place the SQL statements between BEGIN and END block. This is where you
define the logic for the trigger
Example
mysql> Create table account1(acct_num int,amount int);
Query OK, 0 rows affected (0.27 sec)
RESULT:
Thus the programs for insert, delete, and update operations in a database table using
triggers is created and executed successful.
AIM:
To create and execute the View and Index for the large database and tables.
VIEWS:
SQL includes the ability to create stored queries that they can then be used as a basis for
other queries. These stored queries are also called views. A view is simply a derived table
that is built upon the base tables of the database. Base tables are the original database tables
that actually contain data. Views do not actually store data they are temporary tables. To
define a view, we must give the view a name and state the query that computes the view.
Syntax:
Create view v-name as <query expression>
Where query expression is any legal query expression and view name is represented
by v-name.( can give any name for view)
mysql> select * from employee;
+-------+--------+----------+--------+--------+
| empno | ename | job | deptno | salary |
+-------+--------+----------+--------+--------+
| 101 | anitha | s/w deve | 1 | 15000 |
| 102 | kumar | clerk | 2 | 10000 |
| 103 | riwat | db admin | 2 | 24000 |
| 104 | anjur | manager | 2 | 40000 |
| 105 | vijay | TL | 3 | 25000 |
+-------+--------+----------+--------+--------+
5 rows in set (0.00 sec)
RESULT:
Thus the view and index for a large database and table is created and executed successfully.
AIM
Creating XML database and validate it using XML schema.
Procedure
XML
• Xml (eXtensible Markup Language) is a mark up language.
• XML is designed to store and transport data.
• Xml was released in late 90’s. it was created to provide an easy to use and store
self describing data.
• XML became a W3C Recommendation on February 10, 1998.
• XML is not a replacement for HTML.
• XML is designed to be self-descriptive.
• XML is designed to carry data, not to display data.
• XML tags are not predefined. You must define your own tags.
• XML is platform independent and language independent. XML Schema
XML Schema is commonly known as XML Schema Definition (XSD). It is used to describe
and validate the structure and the content of XML data. XML schema defines the elements,
attributes and data types. Schema element supports Namespaces. It is similar to a database
schema that describes the data in a database. How to validate XML against XSD in java:
Java XML Validation API can be used to validate XML against an XSD.
javax.xml.validation.Validator class is used in this program to validate xml file against xsd
file.Here are the sample XSD and XML files used.
Employee.xsd
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.journaldev.com/Employee"
xmlns:empns="http://www.journaldev.com/Employee" elementFormDefault="qualified">
<element name="empRequest" type="empns:empRequest"></element>
<element name="empResponse" type="empns:empResponse"></element>
<complexType name="empRequest">
<sequence>
<element name="id" type="int"></element>
</sequence>
</complexType>
RESULT:
Thus the XML database created and validates it using XML schema
AIM:
To create the document, columns and graphs based on data by using NoSQL tools.
Procedure :
Document database
A document database (also known as a document-oriented database or a document store) is
a database that stores information in documents. A document is a record in a document
database. A document typically stores information about one object and any of its related
metadata. Documents store data in field-value pairs. The values can be a variety of types
and structures, including strings, numbers, dates, arrays, or objects. Documents can be
stored in formats like JSON, BSON, and XML.
Below is a JSON document that stores information about a user named Tom. {
“_id”: 1, “first_name”: “Tom”, “email”: “[email protected]”, “cell”: “765-555-5555”,
“likes”: [ “fashion”, “spas”, “shopping”
],”businesses”: [
{
“name”: “Entertainment 1080”, “partner”: “Jean”, “status”: “Bankrupt”, “date_founded”:
{
“$date”: “2012-05-19T04:00:00Z” }
}, {
“name”: “Swag for Tweens”, “date_founded”: {
“$date”: “2012-11-01T04:00:00Z” }
}
]
}
Collections
A collection is a group of documents. Collections typically store documents that have
similar contents. Continuing with the example above, the document with information
about Tom could be stored in a collection named users. More documents could be added
to the users collection in order to store information about other users. For example, the
document below that stores information about Donna could be added to the users
collection.
{
“_id”: 2, “first_name”: “Donna”, “email”: “[email protected]”, “spouse”: “Joe”,
“likes”: [ “spas”, “shopping”, “live tweeting”
],”businesses”: [
RESULT:
Thus we studied the various NoSQL database tools to create document, column and graph
successfully
Aim:
Write a program in Java to create Displaying login page and home page using Jframe and
Databases (three tier architecture).
Procedure:
Three tier architecture is a very common architecture. A three tier architecture is typically
split into a presentation or GUI tier, an application logic tier, and a data tier. Presentation
tier encapsulates the presentation logic required to serve clients.
Program:
Login.java
package loginpage;
/**
*
* @author 91875
*/
public class LoginPage {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Login log=new Login();
log.show();
}
}
LoginPage.java:
package loginpage;
import com.mysql.jdbc.Connection;
import static java.lang.Class.forName;
import java.sql.DriverManager;
/**
*
* @author 91875
*/
public class Login extends javax.swing.JFrame {
/**
* Creates new form Login
*/
public Login() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1.setText("username");
jLabel2.setText("password");
edtusername.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
edtusernameActionPerformed(evt);
}
});
edtpassword.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
edtpasswordActionPerformed(evt);
}
});
btnlogin.setText("login");
btnlogin.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnloginActionPerformed(evt);
}
});
btnreset.setText("reset");
btnreset.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnresetActionPerformed(evt);
}
});
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel2)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 85,
Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
.addComponent(btnreset)
.addGap(78, 78, 78))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(edtusername,
javax.swing.GroupLayout.PREFERRED_SIZE, 135,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(edtpassword,
javax.swing.GroupLayout.PREFERRED_SIZE, 135,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(66, 66, 66))))
.addGroup(layout.createSequentialGroup()
.addGap(87, 87, 87)
.addComponent(btnlogin)
.addGap(0, 0, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(68, 68, 68)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(edtpassword, javax.swing.GroupLayout.PREFERRED_SIZE,
30, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(41, 41, 41)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnlogin)
.addComponent(btnreset))
.addContainerGap(51, Short.MAX_VALUE))
);
pack();
}// </editor-fold>
Class.forName(driver);
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and
feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVE
RE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVE
RE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVE
RE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
/**
*
* @author 91875
*/
public class homepage extends javax.swing.JFrame {
/**
* Creates new form homepage
*/
public homepage() {
initComponents();
}
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jTextField1.setText("home page");
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and
feel.
* For details see
http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(homepage.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(homepage.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(homepage.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(homepage.class.getName()).log(java.util.logging.Level.S
EVERE, null, ex);
Output:
RESULT:
Simple GUI Database application and incorporate is Developed Successfully
PROBLEM STATEMENT:
INVENTORY MANAGEMENT SYSTEM is a real time application used in the merchant’s
day to day system. this is a database to store the transaction that takes places between the
manufacturer, dealer and the shop keeper that includes stock inward and stock outward with
reference to the dealer. here we assume our self as the dealer and proceed with the transaction
as follows:
The manufacturer is the producer of the items and it contains the necessary information of the
item such as price per item, date of manufacture, best before use, number of item available and
their company address. the dealer is the secondary source of an item and he purchases item
from the manufacturer by requesting the required item with its corresponding company name
and the number of items required. the dealer is only responsible for distribution of the item to
the retailers in the town or city. the shop keeper or retailer is the one who is prime source for
selling items in the market. the customers get item from the shop keeper and not directly from
the manufacturer or the dealer. the stock is the database used in our system which records all
transactions that takes place between the manufacturer and the dealer and the dealer and the
retailer.
ENTITY RELATIONSHIP DIAGRAM:
FORM1
Dim db As Database
Dim rs As Recordset
Private Sub Command1_Click()
Form3.Show
End Sub
Private Sub Command2_Click()
Form4.Show
End Sub
Private Sub Command3_Click()
Form5.Show
End Sub
Private Sub Command4_Click()
End
End Sub
Private Sub Form_Load()
Set db = OpenDatabase("D:\prj789\invent\INVENTORY.MDB")
Set rs = db.OpenRecordset("SYSTEM")
End Sub
FORM2
Dim db As Database
Dim rs As Recordset
Dim i As Integer
Private Sub Command1_Click()
Form1.Show
End Sub
Private Sub Command2_Click()
rs.MoveFirst
For i = 1 To rs.RecordCount
If rs(0) = Text1.Text Then
rs.Edit
If Text7.Text = "" Then
MsgBox "enter the no of items ordered" Else