DBMS Manual Final PDF
DBMS Manual Final PDF
DBMS Manual Final PDF
AIM
To write SQL Statements to create table, add constraints, insert rows, update and delete
rows using Data Definition Language (DDL) and Data Manipulation Language(DML)
1
2. If you are adding values for all the columns of the table, you do not need to specify the column
names in the SQL query. However, make sure the order of the values is in the same order as the
columns in the table. Here, the INSERT INTO syntax would be as follows:
INSERT INTO table_name
VALUES (value1, value2, value3, ...);
The SQL UPDATE Statement
The UPDATE statement is used to modify the existing records in a table.
UPDATE Syntax
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
Note: that you can update one or more fields at a time, and you can use the WHERE clause to
update only specific records that meet certain conditions. You can also update multiple records at
once by omitting the WHERE clause, but be careful with this as it will update all records in the
table.
The SQL DELETE Statement
The DELETE statement is used to delete existing records in a table.
DELETE Syntax
DELETE FROM table_name WHERE condition;
Note: Be careful when deleting records in a table! Notice the WHERE clause in the DELETE
statement. The WHERE clause specifies which record(s) should be deleted. If you omit the
WHERE clause, all records in the table will be deleted!
PROGRAM:
student_id (integer, primary key)
2
insert some data into the table
INSERT INTO students (student_id, first_name, last_name, email, age)
VALUES (1, 'John', 'Doe', '[email protected]', 25),
(2, 'Jane', 'Doe', '[email protected]', 21),
(3, 'Bob', 'Smith', '[email protected]', 30);
SELECT command
SELECT * FROM students;
OUTPUT:
student_id | first_name | last_name | email | age
+ + + +
1 | John | Doe | [email protected] | 25
2 | Jane | Doe | [email protected] | 21
3 | Bob | Smith | [email protected] | 30
UPDATE command
UPDATE students
SET age = 35
WHERE student_id = 3;
update was successful
SELECT * FROM students;
OUTPUT:
student_id | first_name | last_name | email | age
+ + + +
1 | John | Doe | [email protected] | 25
2 | Jane | Doe | [email protected] | 21
3 | Bob | Smith | [email protected] | 35
DELETE command
DELETE FROM students
WHERE student_id = 2;
delete was successful
SELECT * FROM students;
3
OUTPUT:
student_id | first_name | last_name | email | age
+ + + +
1 | John | Doe | [email protected] | 25
3 | Bob | Smith | [email protected] | 35
RESULT:
Thus the SQL Statements to create table, add constraints, insert rows, update and delete rows
using Data Definition Language (DDL) and Data Manipulation Language(DML) commands
was executed successfully
4
Ex.No: 2 CREATE A SET OF TABLES, ADD FOREIGN KEY CONSTRAINTS AND
AIM
To create tables and Execute Data Definition Commands, Data Manipulation Commands to
addforeign key constraints and incorporate referential integrity Statements. We want to create a set
of tables to track orders and their associated products and customers. We'll create two tables:
customers and orders
PROGRAM:
Here's the customers table:
CREATE TABLE customers (
customer_id integer PRIMARY KEY,
first_name varchar(50) NOT NULL,
last_name varchar(50) NOT NULL,
email varchar(50) UNIQUE,
phone_number varchar(20) NOT NULL
);
Here's the orders table:
CREATE TABLE orders (
order_id integer PRIMARY KEY,
order_date date NOT NULL,
customer_id integer NOT NULL,
amount numeric(10, 2) NOT NULL,
FOREIGN KEY (customer_id) REFERENCES customers (customer_id)
);
5
OUTPUT:
INSERT INTO customers (customer_id, first_name, last_name, email, phone_number)
VALUES (1, 'John', 'Doe', '[email protected]', '123-456-7890'),
(2, 'Jane', 'Doe', '[email protected]', '987-654-3210'),
(3, 'Bob', 'Smith', '[email protected]', '555-555-1212');
RESULT:
Thus the Tables are created and added with foreign key constraints and incorporates
referential integrity was successfully executed.
6
Ex.No: 3 QUERY THE DATA TABLES USING DIFFERENT ‘WHERE’CLAUSE
AIM:
Two write a sql program to query the databases using different „where‟ clause conditions
and also implements aggregate functions
LIST OF AGGREGATE FUNCTIONS:
AVG
COUNT
MAX
MIN
STDDEV
SUM
EXAMPLE:
1. AVG:
SQL>select avg(cost) from stores;
2. COUNT:
SQL> select count (client_name) “NO. Of clients:” from client_master;
3. MAX:
SQL> select max (cost) from stores;
7
4. MIN:
SQL>select min (cost) from stores;
5. STDDEV:
SQL>select stddev(cost) from stores;
6. SUM:
SQL> select sum (cost) from stores;
SQL> create table emp(eid number, ename varchar2(10),age number, salary number);
Table created.
SQL> desc emp;
7
(iii) Find the Maximum age from employee table.
SQL> select max(age) from emp;
MAX(AGE)
44
8
(iv) Find the Minimum age from employee table.
SQL> select min(age) from emp;
MIN(AGE)
22
(v) Display the Sum of age employee table.
SQL> select sum(age) from emp;
SUM(AGE)
220
22 29 27 29
(ix) Find grouped salaries of employees.(group by clause)
SQL> select salary from emp group by salary;
SALARY
rohan 6000
alex 7000
shane 8000
abhi 8000
tiger 8000
anu 9000
9
scott 10000
7 rows selected.
ENAME SALARY
scott 10000
anu 9000
RESULT:
Thus the SQL program to query the database using different „where‟ clause conditions and using
different aggregate functions was created and executed successfully.
10
Ex.No: 4 QUERY THE DATABASE TABLES AND EXPLORE SUB QUERIES
Date: AND SIMPLEJOIN OPERATIONS
AIM:
To write Sql queries to query the database tables and explore sub queries and simple join
operations
SUBQUERIES
IN:
SYNTAX:
select * from table1 where in(select attribute from table2);
DESCRIPTION:
The IN connective test for set membership where set is a collection of values produced by a
select clause.
NOT IN:
SYNTAX:
select * from table1 where notin(select attribute from table2);
DESCRIPTION:
The NOTIN connective tests for set membership where set is a collection of values produced by
aselect clause.
ANY/SOME:
SYNTAX:
select * from table1 where attribute > some/any(select attribute from table name(condition));
DESCRIPTION:
The some/any keyword require that atleast one pair compiler, if denotes that the select condition
TRUE if the comparision is TRUE for atlest one of the values that is required.
ALL:
SYNTAX:
select * from table1 where attribute > ALL(select attribute from table where(condition));
DESCRIPTION:
The ALL keyword require that all values from the subselect comply with the comparison
separator.The ALL keyword specifies that the select condition TRUE if the comparision is
TRUEfor everyvalues that the sub query returns.
Examples:
SQL> select * from emp where eno in(select eno from sal);
ENO ENAME DEPT
1 ram cse
11
2 rajan Ece
4 hari Cse
SQL> select * from emp where eno not in(select eno from sal where dept='cse');
SQL> select * from sal where salary>any(select salary from sal where dept='cse');
ENODEPT SALARY
4eee 8000
5cse 10000
SQL> select * from sal where salary>some(select salary from sal where dept='cse');
SQL> select * from sal where salary>all(select salary from sal where dept='cse');no rows
selected
SQL> select * from sal where salary<all(select salary from sal where dept='cse');ENO DEPT
SALARY
2 ece 1000
SYNTAX:
Select attribute 1, 2, …., from table name1,table name2 where t1=t2 attribute;
DESCRIPITION:
A equi join is a SQL join.
NON EQUI JOIN:
SYNTAX:
Select attribute1, attribute2. ........................... from table 1, table2 where table1 attribute <>
table2 attribute
12
DESCRIPTION:
A non equi join is a SQL join whose condition is established using all comparison operatorexcept
the equal (=) operations like <=,>=,<,>
SELF JOIN:
Select distinct t1 attributes _name1 t1 attributes name from table name t1 where attribute
name1=t2.attribute_name and t1.attribute_name in<> t2.attribute_name in
DESCRIPTION:
A self join is a type of SQL join which is used to join a table to itself particularly when the used
table has a foreign key the references its own primary key. It compares values with the columnof
a single table.
Example:
SQL> create table eem(eno number(3),ename varchar2(10),dept varchar2(5));Table created.
1 30000 cse
2 50000 it
5 60000 cse
Equi join:
em, sal where eem.e o=sal.eno;
SQL> select eem.eno,ename,sal from e
ENO ENAME SAL
1 Aaa 30000
2 Bbb 50000
Non equi join:
SQL> select eem.eno,ename,sal from eem,sal where eem.eno<>sal.eno;
13
2 Bbb 30000
2 Bbb 60000
3 Ccc 30000
3 Ccc 50000
3 Ccc 60000
6 rows selected.
7 rows selected.
RESULT:
Thus the SQL queries to query the database tables and explore sub queries and simple join
operations was written and executed successfully.
14
Ex.No: 5 QUERY THE DATABASE TABLES AND EXPLORE, NATURAL,EQUI AND
AIM:
To write Query the database tables and explore, Natural EQUI and Outer joins.
NATURAL JOIN:
SYNTAX:
Select attribute1,2……,
From table name1,table name2,
NATURAL JOIN attribute1,attribute2;
DESCRIPITION:
A natural join is a SQL join,which simply joins two table‟s attributes
EQUIJOIN:
SYNTAX:
Select attribute 1, 2, …., from table name1,table name2 where t1=t2 attribute;
DESCRIPITION:
A equi join is a SQL join.
NON EQUI JOIN:
SYNTAX:
Select attribute1, attribute2. ........................... from table 1, table2 where table1 attribute <>
table2 attribute
DESCRIPITION:
A non equi join is a SQL join whose condition is established using all comparison operatorexcept
the equal (=) operations like <=,>=,<,>
INNER JOIN:
SYNTAX:
Select attribute1, attribute 2. ........................... from table 1 left inner join table2 on condition.
DESCRIPTION:
Inner join returns the matching rows from the tables that are being joined.
OUTER JOIN:
DESCRIPTION:
Right outer join returns the matching rows from the tables that are being joined and also non
matching rows from the right table in the result and the place NULL values in the attribute that
camefrom the left table.
1 aaa Cse
2 bbb It
3 ccc Cse
SQL> select * from sal;
ENO SAL DEPT
1 30000 cse
2 50000 it
5 60000 cse
Equi join:
em, sal where eem.e o=sal.eno;
16
SQL> select eem.eno,ename,sal from e
ENO ENAME SAL
1 Aaa 30000
2 Bbb 50000
Non equi join:
SQL> select eem.eno,ename,sal from eem,sal where eem.eno<>sal.eno;
7 rows selected.
Inner join:
17
ENO ENAME SAL
1 Aaa 30000
2 Bbb 50000
3 Ccc
2. Right outer join
SQL> select eem.eno,ename,sal from eem right join sal on eem.eno=sal.eno;
RESULT:
Thus the simple queries for Natural join,Equi join and Outer join operations are used for
retrieving information by joining tables have been verified and executed successfully.
18
Ex.No: 6 WRITE USER DEFINED FUNCTIONS AND STORED PROCEDURES IN
Date: SQL
AIM:
To write User Defined functions and stored procedures in SQL.
SQL PROCEDURES:
An Oracle stored procedure is a program stored in an Oracle database. The following are the
advantages of using procedures. Better performance: Oracle stored procedures load once into the
shared pool and remain there unless they become paged out. Subsequent executions of the Oracle
stored procedure are far faster than executions of external code.
Coupling of data with behaviour: DBAs can use naming conventions to couple relational tables
with the behaviors associated with a table by using Oracle stored procedures as "methods". If all
behaviors associated with the employee table are prefixed with the table name--employee.hire,
employee.give_raise, for example--the data dictionary can be queries to list all behaviors
associated with a table (select * from dba_objects where owner = 'EMPLOYEE'), and it's easy to
identify and reuse code via stored procedures.
Isolation of code: Since all SQL is moved out of the external programs and into the Oracle stored
procedures, the application programs become nothing more than calls to Oracle stored
procedures. As such, it becomes very simple to swap out one database and swap in another one.
EXECUTION:
SETTING SERVEROUTPUT ON:
SQL> SET SERVEROUTPUT ON
1. PROCEDURE USING POSITIONAL PARAMETERS
SQL> SET SERVEROUTPUT ON
SQL> CREATE OR REPLACE PROCEDURE PROC1 AS2 BEGIN
3 DBMS_OUTPUT.PUT_LINE ('Hello from procedure...');
4 END;
5/
Hello from procedure...
PL/SQL procedure successfully completed.
OUTPUT:
Procedure created.
SQL> VARIABLE T NUMBERSQL> EXEC PROC2 (33, 66: T)
PL/SQL procedure successfully completed.SQL> PRINT T
T
99
INPUT:
Enter value for a: 8old 8: a:=&a;
new 8: a:=8;
Enter value for b: 16old 9: b:=&b;
new 9: b:=16;
OUTPUT:
Procedure created.
SQL> set serveroutput on;
SQL> execute pro;
GCD is8
PL/SQL procedure successfully completed.
SYNTAX:
<declaration_section>BEGIN
<executable_section>EXCEPTION
<exception_section>END;
20
Addition of Two Numbers
1.Write a PL/SQL Program for Addition of Two Numbers
PROCEDURE
1. Start.
2. Initialize the necessary variables.
3. Develop the set of statements with the essential operational parameters.
4.Specify the Individual operation to be carried out.
5.Execute the statements.
6.Stop.
SQL> DECLARE
<VARIABLE DECLARATION>;BEGIN
<EXECUTABLE STATEMENT >;END;
OUTPUT:
C is maximum
PL/SQL procedure successfully completed.
INPUT:
Enter value for number: 2old 5: n:=&number;
new 5: n:=2;
OUTPUT:
entered number is less than 5
PL/SQL procedure successfully completed.
22
ELSEIF (TEST CONDITION) THEN
<STATEMENTS>;
ELSE
<STATEMENTS>;
ENDIF;
END;
INPUT:
Enter value for a: 21old 7: a:=&a;
new 7: a:=21;
Enter value for b: 12old 8: b:=&b;
new 8: b:=12;
Enter value for b: 45old 9: c:=&b;
new 9: c:=45;
OUTPUT:
C is maximum
PL/SQL procedure successfully completed.
begin endvalue:=&endvalue;n:=1;
for n in 1..endvalueloop
if mod(n,2)=1 then sum1:=sum1+n;end if;
end loop;
23
dbms_output.put_line('sum ='||sum1);end;
/
INPUT:
Enter value for endvalue: 4 old 6: endvalue:=&endvalue;
new 6: endvalue:=4;
OUTPUT:
sum =4
PL/SQL procedure successfully completed.
OUTPUT:
sum of odd no. bt 1 and4is4
PL/SQL procedure successfully completed.
PL/SQL FUNCTION:
PROCEDURE
1. Start.
2. Create the table with essential attributes.
3. Initialize the Function to carry out the searching procedure.
4. Frame the searching procedure for both positive and negative searching.
5.Execute the Function for both positive and negative result.
6.Stop.
EXECUTION:
SETTING SERVEROUTPUT ON:
SQL> SET SERVEROUTPUT ON
24
1. IMPLEMENTATION OF FACTORIAL USING FUNCTION
SQL>create function fnfact (n number)return number is
b number;begin b:=1;
for i in 1..nloop b:=b*i; end loop; return b; end;
/ SQL>Declare
n number:=&n;y number; begin y:=fnfact(n);
dbms_output.put_line(y);end;
/
Function created.
Enter value for n: 5
old 2: n number:=&n;new 2: n number:=5; 120
PL/SQL procedure successfully completed.
2. PROGRAM
SQL> create table phonebook (phone_no number (6) primary key,username varchar2(30),doorno
varchar2(10),street varchar2(30),place varchar2(30),pincode char(6));
Table created.
25
Function created.
SQL>declare
2 address varchar2(100);
3 begin
4 address:=findaddress(20312);
5 dbms_output.put_line(address);
6 end;
7/
OUTPUT 1:
Vijay,120/5D,bharathi street,NGO colony,629002PL/SQL procedure successfully
completed.SQL> declare
2 address varchar2(100);
3 begin
4 address:=findaddress(23556);
5 dbms_output.put_line(address);
6 end;
7/
OUTPUT2:
Address not found
PL/SQL procedure successfully completed.
RESULT:
Thus SQL Procedures and user defined functions were written and executed successfully.
26
Ex.No: 7 EXECUTE COMPLEX TRANSACTIONS AND REALIZE DCL AND TCL
Date: COMMAND
AIM:
To write Execute complex transactions and realize DCL and TCL Command.
TCL COMMANDS:
COMMANDS OVERVIEW
SAVEPOINT - identify a point in a transaction to which you can later roll back
SAVEPOINT
Syntax: savepoint username;Input:
SQL> savepoint emp;
Output:
savepoint created;
COMMIT
Syntax: commit;
Input:
SQL> commit;
Output:
Commit complete.
ROLLBACK
Syntax:
rollback to savepoint_text_identifier;
Input:
SQL> rollback to emp;
Output:
Rollback complete.
DCL (Data Control Language)
27
DCL COMMANDS:
DCL provides users with privilege commands the owner of database objects (tables), has the soul
authority ollas them. The owner (data base administrators) can allow other data base users to
access the objects as per their requirement
1. GRANT: The GRANT command allows granting various privileges to other users and
allowing them to perform operations within their privileges.
Example, if a uses is granted as „SELECT‟ privilege then he/she can only view data but cannot
perform any other DML operations on the data base object GRANTED privileges can also be
withdrawn by the DBA at any time
Syntax:
SQL>GRANT PRIVILEGES_NAME on object_name To user_name;
Example:
SQL>GRANT SELECT, UPDATE on emp To hemanth;
OUTPUT:
Query OK, 0 rows affected
2. REVOKE: To with draw the privileges that has been GRANTED to a uses, we use the
REVOKE command
Syntax:
SQL>REVOKE PRIVILEGES_NAME ON object-name FROM user_name;
Example:
SQL>REVOKE SELECT, UPDATE ON emp FROM ravi;
OUTPUT:
Query OK, 0 rows affected
RESULT:
Thus the complex transactions using DCL and TCL commands are executed successfully.
28
Ex.No: 8 WRITE SQL TRIGGERS FOR INSERT, DELETE, AND UPDATE
AIM
To write a PL/SQL query to create a trigger.
TRIGGERS:
UPDATE, DELETE) execute. Triggering SQL statement is may or may notexecute, depending
on the BEFORE trigger conditions block.
2. AFTER Trigger : AFTER trigger execute after the triggering DML statement (INSERT,
UPDATE, DELETE) executed. Triggering SQL statement is execute as soon as followed bythe
code of trigger before performing Database operation.
3. ROW Trigger : ROW trigger fire for each and every record which are performing INSERT,
UPDATE, DELETE from the database table. If row deleting is define as trigger event, when
trigger file, deletes the five rows each times from the table.
4. Statement Trigger : Statement trigger fire only once for each statement. If row deleting is
define as trigger event, when trigger file, deletes the five rows at once from the table.
29
5. Combination Trigger : Combination trigger are combination of two trigger type.
1. Before Statement Trigger : Trigger fire only once for each statement before thetriggering
DML statement.
2. Before Row Trigger : Trigger fire for each and every record before the triggeringDML
statement.
3. After Statement Trigger : Trigger fire only once for each statement after thetriggering DML
statement executing.
4. After Row Trigger : Trigger fire for each and every record after the triggering DMLstatement
executing.
PL/SQL TriggersInserting Trigger
SQL> CREATE or REPLACE TRIGGER trg1
2 BEFORE
3 INSERT ON customer
4 FOR EACH ROW
5 BEGIN
6 :new.name := upper(:new.name);
7 END;
8/
Trigger created.
30
CREATION OF FIRST TABLE
31
4 end;
5/
Trigger created.
S Q1L
00>1upda t ksatundient set regcnsoe=1 5 where7r0egno=1002;1 ro updated.
Trigger created.
32
SQL> select * from student;
REGNO NAME DEPT PERCENTAGE
33
7 end;
8/
Trigger created.
SQL> delete from voter_master where voterid=1000;1 row deleted.
34
9/
Function created.
SQL> declare
3 begin
4 address:=find address(25301);
5 dbms_output.put_line (address);
6 end;
RESULT:
Thus the PL/SQL block for trigger with different controls are verified and executed.
35
Ex.No: 9 CREATE VIEW AND INDEX FOR DATABASE TABLES WITH A LARGE
AIM:
To create a view and index for database tables with a large number of records
VIEW:A view is simply the representation of a SQL statement that is stored in memory so
that itcan easily be re-used. It‟s also referred as logical table.
SQL COMMANDS
Creating views:
Syntax:
Create view<view name>;
Description:
This command is used to create view by combining two tables.
Viewing single row of table:
Syntax:
Create view<view name> as select from <table name>;
Description:
This command is used to view a single row from a particular table.
Viewing all columns from a single table:
Syntax:
Create view<view name> as select * from <table name>;
Description :
This is used to create view which displays all columns from a single table.
View specified column from a single table:
Syntax:
Create view<view table name> as select column1,column2 from <tablename>;
Description:
This command is used to create view which displays on a specified from a single table.
View specified column from a muliple table:
Syntax:
Create view<view table name> as select column1,column2,….columnn where „condition‟;
Description:
This is used to create view to display specified columns from multiple tables.
View all column from a muliple table:
Syntax:
Create view<view table name> as select * from <table name> where „condition‟;
Description:
This is used to create view which displays all the columns of a table.
36
SYNTAX:
CREATE OR REPLACE VIEW <view name > AS < select statement >
INDEXES:
Database system uses indexes to avoid the need for large-table, full-table scans and disk sorts,
which are required when the SQL optimizer cannot find an efficient way to service the SQL
query.
RESULT:
Thus the view and index for database tables with a large number of records was created
successfully.
37
Ex.No: 10 CREATE AN XML DATABASE AND VALIDATE USING XML SCHEMA
Date:
AIM:
To create an XML database and validate it using XML schema.
38
CREATE AN XML SCHEMA CALLED "EMPLOYEES.XSD
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="employees">
<xs:complexType>
<xs:sequence>
<xs:element name="employee" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="id" type="xs:string"/>
<xs:element name="name" type="xs:string"/>
<xs:element name="email" type="xs:string"/>
<xs:element name="department" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
XML FILE VALIDATION USING XML SCHEMA
XML SCHEMA-describes the structure of the XML document.It is also known as XML
Schema Definition(XSD)
LET'S VALIDATE OUR XML FILE USING THE XML SCHEMA:
<?php
$xml = new DOMDocument();
$xml->load('employees.xml');
if ($xml->schemaValidate('employees.xsd')) {
echo "Validation successful!";
} else {
echo "Validation failed!";
}?>
39
Output:
Validation successful!
RESULT:
Thus the XML database was created and it is validated by XML schema successfully.
40
Ex.No: 11 CREATE DOCUMENT, COLUMN AND GRAPH BASED DATA USING
AIM:
To create a document,column and graph based data using NOSQL Database tools
Document-Based Data
// Insert a blog post into the blogposts collection
db.blogposts.insertOne({
title: "My First Blog Post",
content: "This is my very first blog post!",
author: "John Doe",
publishDate: ISODate("2023-04-07T00:00:00Z")
});
Column based data
// Create the userprofiles column family
db.createCollection("userprofiles", {
capped: false,
autoIndexId: true,
max: 10000
});
41
Graph based data
// Create the socialnetwork graph
db.createCollection("socialnetwork", {
capped: false,
autoIndexId: true,
max: 10000
});
Result:
Thus ,the document,column and graph based database application was successfully created.
42
Ex.No: 12 CASE STUDY USING ANY OF THE REAL LIFE DATABASE
AIM:
To case study using the real life database applications –Inventory Management for a EMart
Grocery shop.
stock.
Orders: contains information about each order, including the order date, the products ordered,
information.
Output:
Products Table
+ + + + +
| ID | Name | Price | Stock |
+ + + + +
| 1 | Apples | 2.50 | 100 |
| 2 | Bananas | 1.50 | 50 |
| 3 | Oranges | 2.00 | 75 |
| 4 | Carrots | 1.00 | 200 |
| 5 | Broccoli | 1.50 | 100 |
| 6 | Milk | 3.50 | 50 |
43
| 7 | Eggs | 2.00 | 100 |
| 8 | Chicken | 6.00 | 25 |
| 9 | Ground Beef | 5.00 | 30 |
| 10 | Sliced Bread | 2.50 | 50 |
+ + + + +
Orders Table
+ + + + +
| ID | CustomerID | ProductID | Quantity |
+ + + + +
|1 |1 |1 |5 |
|2 |1 |2 | 10 |
|3 |2 | 3, 4, 5 | 5, 10, 3 |
|4 |3 | 6, 7, 8, 9 | 2, 5, 1, 3 |
|5 |2 | 1, 2, 3, 4, 5, 6, 7, 8, 9 | 1, 1, 1, 1, 1, 1, 1, 1, 1 |
+ + + + +
Customers Table
+ + + + +
| ID | FirstName | LastName | ContactNumber |
+ + + + +
| 1 | John | Smith | 555-1234 |
| 2 | Jane | Doe | 555-5678 |
| 3 | Bob | Johnson | 555-9999 |
+ + + + +
II. Society Financial Management
XYZ Society is a housing society that manages the financial transactions of its members. The
society wants to implement a database system to manage its financial data efficiently. The
database will have the following tables
Members: contains information about each member, including their name, address, and contact
information.
Transactions: contains information about each financial transaction, including the transaction
date, amount, and type of transaction (e.g., maintenance fee, electricity bill, water bill, etc.).
44
Invoices: contains information about each invoice generated, including the invoice date,
45
|5 |2 | 2022-02-01| 2022-02-28| 100 |
|6 |3 | 2022-02-01| 2022-02-28| 100 |
+ + + +
III. Cop Friendly App – Eseva
Eseva is a cop-friendly app that is designed to help police officers access information and data
related to cases and suspects quickly. The app has a database system that stores all the necessary
information related to cases and suspects. The database will have the following tables
Cases: contains information about each case, including the case ID, case description, case
46
Evidence Table
+ + + +
| ID | Description | CaseID |
+ + + +
| 1 | Bloodstains | 1 |
| 2 | Fingerprints | 1 |
| 3 | Video Footage| 1 |
| 4 | Car Parts |2 |
| 5 | Credit Card | 2 |
| 6 | Email Logs | 3 |
+ + + +
IV. Property Management – eMall
eMall is a property management system designed to manage properties like malls, shopping
centers, etc. The system has a database that stores all the necessary information related to
properties, tenants, and rental agreements. The database will have the following tables
Properties: contains information about each property, including the property ID, property
agreement ID, the property ID it belongs to, the tenant ID, rental start and end dates, and rental
amount.
Properties Table
+----+---------------+---------------+---------------------+-------------------+
| ID | PropertyName | Location | PropertyType | PropertyStatus |
+----+---------------+---------------+---------------------+-------------------+
| 1 | Phoenix Mall | Mumbai | Shopping Mall | Open |
| 2 | Westend Mall | Pune | Shopping Complex | Closed |
| 3 | Grand Central | Delhi | Shopping Center | Under Renovation |
+----+---------------+---------------+---------------------+-------------------+
47
Tenants Table
+ + + + + +
| ID | TenantName | ContactNumber | ContactEmail | TenantType |
+ + + + + +
| 1 | Brand Factory | 9123456789 | [email protected] | Retail Clothing |
| 2 | McDonald's | 9987654321 | [email protected] | Food & Beverages |
| 3 | PVR Cinemas | 9123456780 | [email protected] | Entertainment |
+ + + + + +
RentalAgreements Table
+ + + + + + +
| ID | PropertyID | TenantID| Rent | StartDate | EndDate |
+ + + + + + +
|1 |1 |1 | 100000 | 2022-01-01 | 2023-01-01 |
|2 |1 |2 | 50000 | 2022-06-01 | 2023-06-01 |
|3 |2 |3 | 75000 | 2022-04-01 | 2023-04-01 |
+ + + + + + +
V. Star Small and Medium Banking and Finance
Star Small and Medium Banking and Finance is a banking and finance system designed to
manage the banking transactions of small and medium-sized businesses. The system has a
database that stores all the necessary information related to customers, accounts, and
transactions. The database will have the following tables
Customers: contains information about each customer, including their name, contact
account number it belongs to, transaction type, amount, and transaction date.
Customers Table
+ + + + +
| ID | CustomerName | ContactNumber | ContactEmail |
+ + + + +
48
| 1 | ABC Corporation| 9123456789 | [email protected] |
| 2 | XYZ Company | 9987654321 | [email protected] |
| 3 | PQR Limited | 9123456780 | [email protected] |
+ + + + +
Accounts Table
+ + + + + +
| ID | AccountNumber | CustID | AccountType | Balance |
+ + + + + +
| 1 | 100001 |1 | Current | 500000 |
RESULT:
Thus the case study using real life database application –Inventory Management for aEMart
Groery Shop was completed successfully.
49