Dbms Faculty Manuval
Dbms Faculty Manuval
Semester IV
VISION
To develop students with intellectual curiosity and technical expertise to meet the global needs.
MISSION
VISION
To cultivate a generation of globally competitive IT professionals who are equipped with
the knowledge, skills, and adaptability to flourish amidst technological advancements.
MISSION
To achieve academic excellence in Information Technology by fostering a dynamic learning
environment that seamlessly integrates innovative computing methodologies into the teaching
and learning process
To create a nurturing environment for students to develop professionalism, ethical awareness,
and social responsibility while adapting to evolving programming paradigms.
To foster industry-institute collaboration that leverages emerging technologies and
programming expertise, aligning them with global standards and industry expectations
Demonstrate technical competence with analytical and critical thinking to understand and meet
the diversified requirements of industry, academia, and research.
Exhibit technical leadership, team skills, and entrepreneurship skills to provide business solutions to
real- world problems.
Work in multi-disciplinary industries with social and environmental responsibility, work ethics,
and adaptability to address complex engineering and social problems.
Pursue lifelong learning, use cutting-edge technologies, and be involved in applied research to
design optimal solutions
List of Experiments with COs, POs and PSOs
`
Program Outcomes
Have proficiency in programming skills to design, develop and apply appropriate techniques, to solve
complex engineering problems.
Have the knowledge to build, automate, and manage business solutions using cutting-edge technologies.
LIST OF EXPERIMENTS
1. Create a database table, add constraints (primary key, unique, check, Not null),
insert rows, update and delete rows using SQL DDL and DML commands.
2. Create a set of tables, add foreign key constraints and incorporate referential integrity.
3. Query the database tables using different ‘where’ clause conditions and
also implement aggregate functions.
4. Query the database tables and explore sub queries and simple join operations.
5. Query the database tables and explore natural, equi and outer joins.
6. Write user defined functions and stored procedures in SQL.
7. Execute complex transactions and realize DCL and TCL commands.
8. Write SQL Triggers for insert, delete, and update operations in a database table.
9. Create View and index for database tables with a large number of records.
10. Create an XML database and validate it using XML schema.
11. Create Document, column and graph based data using NOSQL database tools.
12. Develop a simple GUI based database application and incorporate all the
above- mentioned features
13. Case Study using any of the real life database applications from the following list
a) Inventory Management for a EMart Grocery Shop
b) Society Financial Management
c) Cop Friendly App – Eseva
d) Property Management – eMall
e) Star Small and Medium Banking and Finance
Build Entity Model diagram. The diagram should align with the
business and functional goals stated in the application.
Apply Normalization rules in designing the tables in scope.
Prepared applicable views, triggers (for auditing
purposes), functions for enabling enterprise grade features.
Build PL SQL / Stored Procedures for Complex Functionalities, ex EOD
Batch Processing for calculating the EMI for Gold Loan for each eligible
Customer.
Ability to showcase ACID Properties with sample queries with appropriate
settings
lOMoARcPSD|39705338
COURSE OBJECTIVES:
COURSE OUTCOMES:
At the end of this course, the students will be able to:
EX: NO: 1
CREATION OF TABLES (DDL COMMANDS)
AIM:
Description:
SQL Command Categories
SQL commands are grouped into four major categories depending on their
functionality. They are as follows:
These SQL commands are used for creating, modifying, and dropping the
structure of database objects. The commands are CREATE, ALTER, DROP, RENAME,
and TRUNCATE.
These SQL commands are used for storing, retrieving, modifying, and
deleting data. These commands are SELECT, INSERT, UPDATE, and DELETE.
These SQL commands are used for managing changes affecting the data.
These commands are COMMIT, ROLLBACK, and SAVEPOINT.
These SQL commands are used for providing security to database objects.
These commands are GRANT and REVOKE.
CREATE
ALTER
DROP
TRUNCATE
RENAME
PROCEDURE
STEP 1: Start
STEP 2: Create the table with its essential attributes.
STEP 3: Execute different Commands and extract information from the table.
lOMoARcPSD|39705338
STEP 4: Stop
SQL COMMANDS
ALTER TABLE tablename RENAME COLUMN old column name TO new column
name;
QUERY: 01
Q1. Write a query to create a table employee with empno, ename, designation, and
salary.
QUERY: 01
Table created.
QUERY: 02
Q2. Write a query to display the column name and datatype of the table employee.
Q3. Write a query for create a new table from an existing table with all the fields.
QUERY: 03
SQL> CREATE TABLE EMP1 AS SELECT * FROM EMP;
Table created.
SQL> DESC
EMP1
Name Null? Type
----------------------------------------- --------
------------------ EMPNO NUMBER(4)
ENAME VARCHAR(10)
DESIGNATIN VARCHAR(10)
SALARY NUMBER(8,2)
QUERY: 04
Q4. Write a query to create a table from an existing table with selected fields.
Syntax
SQL> CREATE TABLE <TARGET TABLE NAME> SELECT EMPNO, ENAME
FROM <SOURCE TABLE NAME>;
QUERY: 04
SQL> CREATE TABLE EMP2 AS SELECT EMPNO, ENAME FROM EMP;
Table created.
QUERY: 06
Q6. Write a Query to Alter the column EMPNO NUMBER (4) TO EMPNO NUMBER(6).
lOMoARcPSD|39705338
QUERY: 06
SQL>ALTER TABLE EMP MODIFY EMPNO NUMBER (6);
Table altered.
QUERY: 07
Q7. Write a Query to Alter the table employee with multiple columns
(EMPNO, ENAME.)
QUERY: 07
SQL>ALTER TABLE EMP MODIFY EMPNO INT (7),MODIFY ENAME
VARCHAR(12));
Table altered.
QUERY: 08
QUERY: 08
QUERY: 09
Table altered.
SQL> DESC EMP;
Name Null? Type
----------------------------------------- -------- ----------------------------
EMPNO NUMBER(7)
ENAME VARCHAR(12)
DESIGNATIN VARCHAR2(10)
SALARY NUMBER(8,2)
QUALIFICATION VARCHAR(6)
DOB DATE
DOJ DATE
QUERY: 10
Q10. Write the query to change the table name emp as employee
QUERY: 11
Q11. Write the query to change the column name empno to eno of the table
employee
SQL> ALTER TABLE employee RENAME COLUMN EMPNO TO ENO;
DOB DATE
DOJ DATE
REMOVE / DROP
QUERY: 12
QUERY: 13
QUERY: 14
DML COMMANDS
These SQL commands are used for storing, retrieving, modifying, and
deleting data. These commands are SELECT, INSERT, UPDATE, and DELETE.
INSERT- This is used to add one or more rows to a table. The values
are separated by commas and the data types char and date are enclosed
in apostrophes. The values must be entered in the same order as they are
defined.
PROCEDURE:
STEP 1: Start.
STEP 2: Create the table with its essential
attributes. STEP 3: Insert the record into table.
STEP 4: Update the existing records into the table.
STEP 5: Delete the records in to the table.
SQL COMMANDS
INSERT
QUERY:
01
Q1. Write a query to insert the records in to employee.
…..); QUERY: 01
1 row created.
SELECT
QUERY: 02
QUERY: 02
UPDATE
QUERY: 04
Q1. Write a query to update the records from employee.
Syntax for update Records from the table:
QUERY: 04
SQL> UPDATE EMP SET SALARY=16000 WHERE EMPNO=101;
1 row updated.
QUERY: 05
Q5. Write a query to update multiple records from employee.
QUERY: 05
DELETE
QUERY: 06
Q5. Write a query to delete records from employee.
EMP;
Result:
Thus the DDL, DML commands are executed in SQL and verified
successfully.
AIM:
To execute and verify the SQL commands for adding constraints.
SQL Constraints
SQL constraints are used to specify rules for the data in a table.
Constraints are used to limit the type of data that can go into a
table. This ensures the accuracy and reliability of the data in the
table. If there is any violation between the constraint and the data
action, the action is aborted.
PROCEDURE:
STEP 1: Start.
STEP 2: Create the table with its essential attributes.
STEP 3: Add the constraint as a column level and table level
STEP 4: check all the constraints with specified conditions.
Create table1:
SQL> create table emp(empno int(3),empname varchar(20),age
int(3),deptno int(3),salary float(7,2),phno int(5));
SQL>desc emp;
PRIMARY KEY
Q1: create the department table with the primary key as a table
level constraint.
Q2: Alter the employee table with the primary key as a column
level constraint.
CHECK CONSTRAINT:
DEFAULT CONSTRAINT:
UNIQUE CONSTRAINT
Q6: create a unique constraint for the column phone number and check
the constraint
Q7:
foreign key
Q10:
primary key
check
not null
unique
dropping constraints
Result:
Thus the SQL statements for executing constraints are executed successfully.
EX: NO: 3
WHERE CLAUSE CONDITIONS AND IMPLEMENT
AGGREGATE FUNCTIONS
AIM:
To execute and verify the SQL commands using where clause conditions and
implement aggregate functions.
PROCEDURE:
Create table 2:
SQL> select empname,empid from emp where salary between 20000 and 40000;
Q4: Display the employee names that ends with letter a. SQL>
Q8: display the employee details having employee id greater than 103 and
department number 4.
Q10: display the employee details that are not in 102 and 104
Aggregate Functions:
Create table 2:
Q3:Display the company name which one having more than one employee.
SQL> insert into works values(105,'wipro','bangalore',30000);
Query OK, 1 row affected (0.03 sec)
emp;
+------------+
| average |
+------------+
| 36000.0000 |
+------------+
Q10: Display company name which one is having less sum of salary compared
to others
SQL> select companyname from works group by companyname having
sum(salary)<=all(select sum(salary)from works group by companyname);
+-------------+
| companyname |
+-------------+
| infosis |
+-------------+
order by clause:
Result:
Thus the where clause conditions using SQL statements are verified
and executed successfully.
AIM:
To Query the Database Table and explore Sub queries and simple Join
Operations.
SUB-QUERY:
A sub-query is a SQL query nested inside a larger query. A Sub Query can also be called
a Nested/Inner Query.
1. SELECT CLAUSE
2. FROM CLAUSE
3. WHERE CLAUSE
CREATE TABLE 1:
+ + + + +
+ + + + +
| 1 | ASHI | 16 | 10000 |
| 2 | ANI | 18 | 20000 |
| 3 | BISMI | 17 | 15000 |
+ + + + +
CREATE TABLE 2:
+ + + +
+ + + +
| 3 | 17 | 15000 |
| 1 | 16 | 10000 |
| 4 | 16 | 20000 |
+ + + +
sec)
A sub-query in a WHERE clause can be used to qualify a column against a set of rows.
SYNTAX:
SQL> SELECT * FROM REPORT WHERE EMPID IN(SELECT EMPID FROM EMP
WHERE EMPNAME='BISMI');
+ + + +
+ + + +
| 3 | 17 | 15000 |
+ + + +
SYNTAX:
+ + +
| EMPNAME | AGE |
+ + +
| ASHI | 16.0000 |
| BISMI | 17.0000 |
+ + +
+ + + + +
+ + + + +
| 1 | ASHI | 16 | 10000 |
+ + + + +
SYNTAX:
+ + +
| EMPID | MAX(SALARY) |
+ + +
| 2| 20000 |
| 3| 15000 |
+ + +
JOINS:
The USING clause specifies which columns to test for equalitywhen two tables are
joined.
SYNTAX:
+ + + + + + +
+ + + + + + +
+ + + + + + +
ON clause can be used to join columns that have different names. Use the
ON clause to specify conditions or specify columns to join.
SYNTAX:
+ + + + +
+ + + + +
| BISMI | 3 | 17 | 15000 |
| ASHI | 1 | 16 | 10000 |
+ + + + +
Result:
Thus the where clause conditions using SQL statements are verified and
executed successfully.
AIM:
To Query the Database Table and explore natural, equi and outer join operations.
CREATE TABLE 1:
CREATE TABLE 2:
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
+ + + + + + +
(0.06 sec)
+ + + +
+ + + +
| Ajay | Chennai | 11 |
| Vijay| Banglore | 12 |
| Sujay | Chennai | 13 |
| Jay | Madurai | 14 |
+ -+ + +
+ + + +
| 11 | IT | 20000 |
| 12 | CSE | 20020 |
| 13 | IT | 20050 |
| 14 | CSE | 20000 |
+ + + +
A natural join is a type of join operation that creates an implicit join by combining tables
based on columns with the same name and data type
Syntax:
+ + + + + +
+ + + + + +
+ + + + + +
SQL CROSS JOIN is used to combine all possibilities of the two or more
tablesand returns the result that contains every row from all contributing tables. The
CROSS JOIN is also known as CARTESIAN JOIN, which provides the Cartesian
product of allassociated tables.
Syntax:
+ + + + + + +
+ + + + + + +
+ + + + + + +
The SQL Inner Join is used to returns only those results from the tables
that match the specified condition and hides other rows and columns. SQL assumes it as
a default Join, so it is optional to use the Inner Join keyword with the query.
Syntax:
+ + + + + + +
+ + + + + + +
The LEFT JOIN returns all the rows from the table on the left even if no
matching rows have been found in the table on the right. Where no matches have been
found in the table on the right, NULL is returned.
Syntax:
+ + + + + + +
+ + + + + + +
RIGHT JOIN is obviously the opposite of LEFT JOIN. The RIGHT JOIN returns all the
columns from the table on the right even if no matching rows have been found in the
table on the left. Where no matches have been found in the table on the left, NULL is
returned.
Syntax:
+ + + + + + +
+ + + + + + +
+ + + + + + +
Result:
Thus the SQL commands to execute the natural, equi and outer join
operations are executed and verified successfully.
AIM:
1. Create tables.
2. Create procedures and functions.
3. Call procedures and functions to perform listed operations
4. Report the answers.
PROCEDURE:
Syntax:
Create Table1:
Create Procedure:
-> begin
-> end
-> &&
SQL> delimiter ;
->&&
Call Procedure:
->&&
Out PUT:
2. Write a pl/sql programto find the product of 3 numbers in a procedure using in &
out parameter.
Create Procedure:
-> begin
-> end
-> &&
SQL> delimiter ;
->&&
->&&
->&&
Output:
@ans
36
The function which is defined by the user is called a user-defined function. SQL
user-defined functions may or may not have parameters that are optional, butit always
returns a single value that is mandatory. The returned value which is return by the
SQL Function can be of any valid SQL data type.
Inserting record:
Create Function:
-> BEGIN
-> END
-> &&
Calling Function:
-> &&
Result:
Thus the procedures user defined function were created and executed
successfully.
AIM:
To create and execute complex transactions and realize DCL and TCL commands.
1. Create table.
2. Perform DCL and TCL commands.
3. Execute different user privileges.
4. Report the answers.
DCL (Data Control Language):
DCL includes commands such as GRANT and REVOKE which mainly deal
with the rights, permissions, and other controls of the database system.
SAVEPOINT SAVEPOINT_NAME;
TCL Exercises:
SQL> select * from employee;
+ + + + +
| empid | name | salary | dob |
+ + + + +
| 1001 | pragya | 10000 | 2001-02-28 |
| 1002 | anu | 20000 | 2002-05-28 |
| 1003 | bob | 30000 | 2000-01-18 |
+ + + + +
3 rows in set (0.17 sec)
START TRANSACTION:
SQL> start transaction;
QueryOK, 0 rows affected (0.00 sec)
CREATE SAVEPOINT:
SQL> savepoint s1;
QueryOK, 0 rows affected (0.01 sec)
UPDATE TABLE
COMMIT TRANSACTION:
SQL> commit;
QueryOK, 0 rows affected (0.16 sec)
+ +
| root@localhost |
+ +
1 row in set (0.00 sec)
Result:
Thus the TCL and DCL commands were executed and verified successfully.
AIM:
To develop and execute a Trigger for Before and After update, Delete, Insert
operations on a table
Trigger:
Types Of Triggers:
Before: Before triggers are fired before the DML statement is actually executed.
After: After triggers are fired after the DML statement has finished execution.
For each row: It specifies that the trigger fires once per row.
For each statement: This is the default trigger that is invoked. It specifies that
the trigger fires once per statement.
:new
:old
These two variables retain the new and old values ofthe column updated in the database.
The values in these variables can be used in the database triggers for data manipulation.
Snytax:
CREATE TRIGGER <trigger name> <trigger time > <trigger event> ON <table
name> FOR EACH ROW <trigger body>;
Everytrigger associated with a table has a unique name and function based on
two factors:
Delete Triggers
Alternatively, use:
Procedure:
1. Create a table called person with name and age for columns.
3. Create a table called person_archive with name, age, and time columns:
The BEFORE INSERT trigger gives control over data modification before
committing into a database table..
Create a BEFORE INSERT trigger to check the age value before inserting
data into the person table:
delimiter //
CREATE TRIGGER person_bi BEFORE INSERT
ON person
FOR EACH ROW
IF NEW.age < 18 THEN
SIGNAL SQLSTATE '50001' SET MESSAGE_TEXT = 'Person must be older
than 18.';
END IF; //
delimiter ;
Inserting data activates the trigger and checks the value of age before
committing the information:
The console displays the descriptive error message. The data does not
insert into the table because of the failed trigger check.
The AFTER INSERT trigger is useful when the entered row generates a
value needed to update another table.
Inserting a new row into the person table does not automatically update the
average in the average_age table. Create an AFTER INSERT trigger on
the person table to update the average_age table after insert:
delimiter //
CREATE TRIGGER person_ai AFTER INSERT
ON person
FOR EACH ROW
UPDATE average_age SET average = (SELECT AVG(age) FROM person); //
delimiter ;
Inserting a new row into the person table activates the trigger:
<trigger body>;
If there is an age restriction for the person table before inserting data, the age
restriction should also exist before updating information. Without
the BEFORE UPDATE trigger, the age check trigger is easy to
avoid. Nothing restricts editing to a faulty value.
Add a BEFORE UPDATE trigger to the person table with the same body as
the BEFORE INSERT trigger:
delimiter //
CREATE TRIGGER person_bu BEFORE UPDATE
ON person
FOR EACH ROW
IF NEW.age < 18 THEN
SIGNAL SQLSTATE '50002' SET MESSAGE_TEXT = 'Person must be older than
18.';
END IF; //
delimiter ;
Updating the age to a value less than 18 displays the error message, and the
information does not update.
The AFTER UPDATE trigger helps keep track of committed changes to data.
Most often, any changes after inserting information also happen after updating
data.
Any successful updates to the age data in the table person should also update
the intermediate average value calculated in the average_age table.
delimiter //
CREATE TRIGGER person_au AFTER UPDATE
ON person
FOR EACH ROW
UPDATE average_age SET average = (SELECT AVG(age) FROM person); //
delimiter ;
lOMoARcPSD|39705338
Updating the table person also updates the average in the average_age table.
delimiter //
CREATE TRIGGER person_bd BEFORE DELETE
ON person
FOR EACH ROW
INSERT INTO person_archive (name, age)
VALUES (OLD.name, OLD.age); //
delimiter ;
Inserting the value back into the person table keeps the log of the deleted data
in the person_archive table:
The BEFORE DELETE trigger is useful for logging any table change
attempts.
The AFTER DELETE triggers maintain information updates that require the
data row to disappear before making the updates.
delimiter //
CREATE TRIGGER person_ad AFTER DELETE
ON person
FOR EACH ROW
UPDATE average_age SET average = (SELECT AVG(person.age) FROM person); //
delimiter ;
Deleting a record from the table person updates the average_age table with
the new average:
Without the AFTER DELETE trigger, the information does not update
automatically.
Result:
Thus the Trigger for Before and After update, Delete, Insert operations were
executed successfully.
AIM:
To create view and index for database tables with a large number of records.
.
VIEWS
OBJECTIVE:
PROCEDURE
STEP 1: Start
STEP 2: Create the table with its essential
attributes. STEP 3: Insert attribute values into the
table.
STEP 4: Create the view from the above created table.
STEP 5: Execute different Commands and extract information from the View.
STEP 6: Stop
SQL COMMANDS
COMMANDS EXECUTION
CREATION OF TABLE
DESCRIPTION OF TABLE:
DISPLAY VIEW:
SQL>SELECT * FROM EMPLOYEE;
CREATION OF VIEW
DESCRIPTION OF VIEW
DISPLAY VIEW:
SQL> SELECT * FROM EMPVIEW;
INSERT STATEMENT:
SYNTAX:
DELETION OF VIEW:
DELETE STATEMENT:
SYNTAX:
UPDATE STATEMENT:
SYNTAX:
DROP A VIEW:
SYNTAX:
SQL> DROP VIEW <VIEW_NAME>
EXAMPLE:
INDEX
Note: Updating a table with indexes takes more time than updating a table without
(because the indexes also need an update). So you should only create indexes on
columns (and tables) that will be frequently searched against.
CREATE INDEX
Syntax
To access the query plan for the SELECT query, execute the following:
After executing the above statement, the index is created successfully. Now, run
the below statement to see how SQL internally performs this query.
SHOW INDEXES:
DROPPING INDEXES
Result:
Thus the views and indexes created on person table were executed successfully.
EX: NO: 10
CREATION OF XML DATABASE AND VALIDATION USING
XML SCHEMA
AIM:
To Create a XML database and validation using XML schema.
Procedure:
<?xml version="1.0">
<xs:schema xmlns:xs="http://www.w3.org/2001/XML Schema">
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="first_name" type="xs:string/>
<xs:element name="last_name" type="xs:string/>
<xs:element name="weight">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:float">
<xs:attribute name="scale"
type="xs:string"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
6. Copy first few lines of code in first box and the generated code in the second box.
lOMoARcPSD|39705338
RESULT:
Thus the creation of XML database and validation using XML schema was
executed successfully.
Ex no:11
CREATE DOCUMENT, COLUMN AND GRAPH
BASED DATA USING NOSQL DATABASE
TOOLS
AIM:
To create a document-based NoSQL database using MongoDB, with columns and graphs,
and populate it with sample data.
NOSQL :
NOSQL (Not Only SQL) is a type of database that does not use the traditional relational
model that has been used in traditional SQL databases. Instead, NoSQL databases use a non-
relational approach for data storage and retrieval. They are designed to handle large amounts of
unstructured, semi-structured, and structured data, including text, images, videos, and social
media data.
NoSQL databases are often used in big data and real-time web applications, where high
performance and scalability are essential. Some popular examples of NoSQL databases include
MongoDB, Cassandra, Couchbase, and Apache HBase.
VIEW DATABASE:
In MongoDB, a view is a virtual collection that presents the results of a pre-defined
aggregation pipeline as if it were a collection of documents. Views do not store data
themselves but rather provide a read-only representation of the data in one or more underlying
collections.
CREATING DATABASE:
In the mongo shell, you can create a database with the help of the following command. This
command actually switches you to the new database if the given name does not exist and if the
given name exists, then it will switch you to the existing database. Now at this stage, if you use
the show command to see the database list where you will find that your new database is not
present in that database list because, in MongoDB, the database is actually created when you
start entering data in that database.
SYNTAX:
use database_name
CREATING COLLECTION:
In MongoDB, a collection is a grouping of MongoDB documents, similar to a table in a
relational database. To create a collection in MongoDB, you can use the
db.createCollection() method.
SYNTAX:
db.createCollection(name, options)
INSERTMANY COMMAND:
insertMany is a method in MongoDB that allows you to insert multiple documents into a
collection at once. The method takes an array of documents as its argument, and inserts each
document as a separate document in the collection.
SYNTAX:
db.collection.insertMany(
[ <document 1> , <document 2>, ... ],
{
writeConcern: <document>,
ordered: <boolean>
}
)
QUERY AND
OUTPUT:
DOCUMENT VIEW:
GRAPHICAL VIEW:
Step 1: Open MongoDB Compass Application.
Step 3: From the Databases select the database which has the collection you want to
insert document.
Step 4: Click the collection -> ADD DATA -> Insert document. Add fields to the
document and click Insert.
In MongoDB, we can find a single document using the findOne() method, This method
returns the first document that matches the given filter query expression.
SYNTAX:
db.collection_name.findOne ()
SYNTAX:
db.collection_name.find().pretty()
SYNTAX:
SYNTAX:
db.collection_name.deleteOne({})
DROPPING A COLLECTION:
SYNTAX:
db.collection_name.drop()
DROP A DATABASE:
In MongoDB, databases hold collections of documents. On a single MongoDB server,
we can run multiple databases. when you install MongoDB some databases are
automatically generated to use. many times you need to delete some database when the
database is no longer used.
db.dropDatabase() the command is used to drop an existing database. This command will
delete the currently selected database. If you have not selected any database, then it will
delete the default ‘test’ database.
SYNTAX:
db.dropDatabase()
RESULT:
Thus create a document-based NoSQL database using MongoDB, with columns and graphs,
and populate it with sample data.
Ex.No:12
Date : HOSPITAL MANAGEMENT SYSTEM
AIM:
To create a hospital management system using VB as front end and
oracle as back end.
PROGRAM:
FORM 1
Private Sub disp_Click()
Dim k As Integer
Adodc1.Recordset.MoveFirst
Do Until Adodc1.Recordset.EOF
k = Val(Combo1.Text)
If Adodc1.Recordset.Fields(0) = k Then
Text1.Text = Val(Adodc1.Recordset.Fields(0))
Text2.Text = Adodc1.Recordset.Fields(1)
Text3.Text = Adodc1.Recordset.Fields(2)
Text4.Text = Adodc1.Recordset.Fields(3)
Text5.Text = Val(Adodc1.Recordset.Fields(4))
Text6.Text = Adodc1.Recordset.Fields(5)
Text7.Text = Val(Adodc1.Recordset.Fields(6))
Text8.Text = Adodc1.Recordset.Fields(7)
Exit Sub
Adodc1.Recordset.MoveLast
Else
Adodc1.Recordset.MoveNext
End If
Loop
End
Sub
Private Sub Text11_Change()
Text13.Text = Val(Text10.Text) +
Val(Text11.Text) End Sub
Private Sub
update_Click()
Adodc1.Recordset.update
End Sub
Private Sub exit_Click()
End
End Sub
Private Sub Form_Load()
Do Until Adodc1.Recordset.EOF
Combo1.AddItem Adodc1.Recordset.Fields(0)
Adodc1.Recordset.MoveNext
Loop
Text13.Text =
0 End Sub
FORM 2
lOMoARcPSD|39705338
Private Sub
Combo1_Click() Text7.Text
= Combo1.Text
Adodc2.Recordset.MoveFirst
Do Until Adodc2.Recordset.EOF
If Adodc2.Recordset.Fields(0) = Val(Combo1.Text) Then
Text9.Text = Adodc2.Recordset.Fields(1)
Exit Sub
Else
Adodc2.Recordset.MoveNext
End If
Loop
End
Sub
Private Sub Command1_Click()
Adodc1.Recordset.AddNew
End Sub
RESULT: