RDBMS Labfile
RDBMS Labfile
CSH216B-T&P
Vision
To educate students in frontier areas of knowledge enabling them to take up challenges as ethical and
responsible global citizens
Mission
Vision
Mission
· To develop and impart knowledge and skills in the field of Computer Science
and Engineering.
· To focus on new techniques, tools and technology, in ethical and responsible
manner.
· To encourage and support the generation and implementation of innovative
ideas.
· To carry out collaborative inter-disciplinary Academic and Research activities.
· To create employment-ready human resources.
PSO1: Attain the ability to design and develop computer programs and possess acquaintance with emerging
technologies and open source platforms in the area of mobile app development, artificial intelligence, machine
learning, web development, data analytics, cloud computing and networking to build effective computer-based
systems
PSO2: Acquire technical competency to deliver computer based innovative and effective solutions to tackle
business and societal challenges, for pursuing successful career, entrepreneurship, research and higher studies.
Bloom’s Taxonomy (BTs)
BT1- Knowledge: Knowledge involves recognizing or remembering facts, terms, basic concepts, or answers
without necessarily understanding what they mean.
BT2-Comprehension: Comprehension involves demonstrating understanding of facts and ideas by
organizing, comparing, translating, interpreting, giving descriptions, and stating the main ideas.
BT3-Applications: Applying involves using acquired knowledge—solving problems in new situations by
applying acquired knowledge, facts, techniques and rules. Learners should be able to use prior knowledge to
solve problems, identify connections and relationships and how they apply in new situations.
BT4-Analysis: Analyzing involves examining and breaking information into component parts, determining
how the parts relate to one another, identifying motives or causes, making inferences, and finding evidence to
support generalizations.
BT5-Synthesis: Synthesizing involves building a structure or pattern from diverse elements; it also refers to
the act of putting parts together to form a whole.
BT6-Evaluation: Evaluating involves presenting and defending opinions by making judgments about
information, the validity of ideas, or quality of work based on a set of criteria.
Program Outcomes (POs)
PO1: Ability to Apply knowledge of management theories and practices to solve business problems.
PO2: Demonstrate foundational knowledge of the functional areas of business
PO3: Foster Analytical and critical thinking abilities for data-based decision making in Organizational Context
PO4: Ability to use appropriate decision support tools.
PO5: Contribute to knowledge Creation
PO6: Ability to understand, analyze and communicate regional, national, global economic, legaland Ethical aspects of
business.
PO7: Ability to work effectively in a team situation.
PO8: Ability to demonstrate specialized knowledge and competencies in their area.
PO9: Ability to write and orally present ideas effectively in business English.
PO10: Demonstrate sensitivity to societal needs and issues
INDEX
6. To explore “SELECT” clause using where, order by, between, like, group by,
having
etc.
7. Creating queries with DML commands, Operators
8. Creating and updating Table Views
9. Introduction SQL Report writing tool
10. Introduction to PL/SQL
11. Revision
By an estimate, around 90% of the world’s data has been created in the last two years
alone. Moreover, 80% of the data is unstructured or available in widely varying structures,
which are difficult to analyze.
As IT systems are being developed, it has been observed that structured formats like
databases have some limitations with respect to handling large quantities of data.
It has also been observed that it is difficult to integrate information distributed across
multiple systems.
Further, most business users do not know what should be analyzed and discover
requirements only during the development of IT systems. As data has grown, so have ‘data
lakes’ within enterprises.
Potentially valuable data for varied systems such as Enterprise Resource Planning or ERP
(and Supply Chain Management or SCM (read as S-C-M) are either dormant or discarded. It
is often too expensive to integrate large volumes of unstructured data.
The data in it will be of three types.
● Structured data −Relationaldata.
● Semi Structured data −XMLdata.
● Unstructured data −Word, PDF, Text, MediaLogs.
LAB 2
Introduction to Relational Database Management
System, SQL
SQL
o SQL stands for Structured Query Language. It is used for storing and managing data in
relational database management system (RDMS).
o It is a standard language for Relational Database System. It enables a user to create, read,
update and delete relational databases and tables.
o All the RDBMS like MySQL, Informix, Oracle, MS Access and SQL Server use SQL as their
standard database language.
o SQL allows users to query the database in a number of ways, using English-like statements.
Rules:
SQL follows the following rules:
o Structure query language is not case sensitive. Generally, keywords of SQL are written in
uppercase.
o Statements of SQL are dependent on text lines. We can use a single SQL statement on one or
multiple text line.
o Using the SQL statements, you can perform most of the actions in a database.
o SQL depends on tuple relational calculus and relational algebra.
SQL process:
o When an SQL command is executing for any RDBMS, then the system figure out the best way
to carry out the request and the SQL engine determines that how to interpret the task.
o In the process, various components are included. These components can be optimization
Engine, Query engine, Query dispatcher, classic, etc.
o All the non-SQL queries are handled by the classic query engine, but SQL query engine won't
handle logical files.
Characteristics of SQL
o SQL is easy to learn.
o SQL is used to access data from relational database management systems.
o SQL can execute queries against the database.
o SQL is used to describe the data.
o SQL is used to define the data in the database and manipulate it when needed.
o SQL is used to create and drop the database and table.
o SQL is used to create a view, stored procedure, function in a database.
o SQL allows users to set permissions on tables, procedures, and views.
SQL Datatype
o SQL Datatype is used to define the values that a column can contain.
o Every column is required to have a name and data type in the database table.
Datatype of SQL:
LAB 3
Introduction to DDL, DML, DCL queries.
SQL Commands
o SQL commands are instructions. It is used to communicate with the database. It is also used
to perform specific tasks, functions, and queries of data.
o SQL can perform various tasks like create a table, add data to tables, drop the table, modify
the table, set permission for users.
o CREATE
o ALTER
o DROP
1. CREATE TABLE TABLE_NAME (COLUMN_NAME DATATYPES[,....]);
Example:
1. CREATE TABLE EMPLOYEE(Name VARCHAR2(20), Email VARCHAR2(100), DOB DATE);
b. DROP: It is used to delete both the structure and record stored in the table.
Syntax
1. DROP TABLE table_name;
Example
1. DROP TABLE EMPLOYEE;
c. ALTER: It is used to alter the structure of the database. This change could be either to
modify the characteristics of an existing attribute or probably to add a new attribute.
Syntax:
1. ALTER TABLE table_name ADD column_name COLUMN-definition;
1. ALTER TABLE table_name MODIFY(column_definitions....);
EXAMPLE
1. ALTER TABLE STU_DETAILS ADD(ADDRESS VARCHAR2(20));
2. ALTER TABLE STU_DETAILS MODIFY (NAME VARCHAR2(20));
d. TRUNCATE: It is used to delete all the rows from the table and free the space containing
the table.
Syntax:
1. TRUNCATE TABLE table_name;
Prerequisites
Step 2: Next, there are two options available to download the setup. Choose the version
number for the MySQL community server, which you want. If you have good internet
connectivity, then choose the mysql-installer-web-community. Otherwise, choose the other
one.
Step 2: In the next wizard, choose the Setup Type. There are several types available, and
you need to choose the appropriate option to install MySQL product and features. Here, we
are going to select the Full option and click on the Next button.
This option will install the following things: MySQL Server, MySQL Shell, MySQL
Router, MySQL Workbench, MySQL Connectors, documentation, samples and examples, and
many more.
Step 3: Once we click on the Next button, it may give information about some features that
may fail to install on your system due to a lack of requirements. We can resolve them by
clicking on the Execute button that will install all requirements automatically or can skip
them. Now, click on the Next button.
Step 4: In the next wizard, we will see a dialog box that asks for our confirmation of a few
products not getting installed. Here, we have to click on the Yes button.
After clicking on the Yes button, we will see the list of the products which are going to be
installed. So, if we need all products, click on the Execute button.
Step 5: Once we click on the Execute button, it will download and install all the products.
After completing the installation, click on the Next button.
Step 6: In the next wizard, we need to configure the MySQL Server and Router. Here, I am
not going to configure the Router because there is no need to use it with MySQL. We are
going to show you how to configure the server only. Now, click on the Next button.
Step 7: As soon as you will click on the Next button, you can see the screen below. Here, we
have to configure the MySQL Server. Now, choose the Standalone MySQL Server/Classic
MySQL Replication option and click on Next. Here, you can also choose the InnoDB Cluster
based on your needs.
Step 8: In the next screen, the system will ask you to choose the Config Type and other
connectivity options. Here, we are going to select the Config Type as 'Development
Machine' and Connectivity as TCP/IP, and Port Number is 3306, then click on Next.
Step 9: Now, select the Authentication Method and click on Next. Here, I am going to select
the first option.
Step 10: The next screen will ask you to mention the MySQL Root Password. After filling the
password details, click on the Next button.
Step 11: The next screen will ask you to configure the Windows Service to start the server.
Keep the default setup and click on the Next button.
Step 12: In the next wizard, the system will ask you to apply the Server Configuration. If you
agree with this configuration, click on the Execute button.
Step 13: Once the configuration has completed, you will get the screen below. Now, click
on the Finish button to continue.
Step 14: In the next screen, you can see that the Product Configuration is completed. Keep
the default setting and click on the Next-> Finish button to complete the MySQL package
installation.
Step 15: In the next wizard, we can choose to configure the Router. So click on Next->Finish
and then click the Next button.
Step 16: In the next wizard, we will see the Connect to Server option. Here, we have to
mention the root password, which we had set in the previous steps.
In this screen, it is also required to check about the connection is successful or not by
clicking on the Check button. If the connection is successful, click on the Execute button.
Now, the configuration is complete, click on Next.
Step 17: In the next wizard, select the applied configurations and click on the Execute
button.
Step 18: After completing the above step, we will get the following screen. Here, click on
the Finish button.
Step 19: Now, the MySQL installation is complete. Click on the Finish button.
Verify MySQL installation
Once MySQL has been successfully installed, the base tables have been initialized, and the
server has been started, you can verify its working via some simple tests.
LAB 5
To explore “SELECT” clause using where clause
Data Query Language
DQL is used to fetch the data from the database.
o SELECT
Syntax:
1. SELECT expressions
2. FROM TABLES
3. WHERE conditions;
For example:
1. SELECT emp_name
2. FROM employee
3. WHERE age > 20;
LAB 6
To explore “SELECT” clause using where, order by, between,
like, group by, having and Logical operators
SQL Operator
There are various types of SQL operator:
- It is used to subtract the right-hand operand from the left-hand a-b will give
operand. 10
/ It is used to divide the left-hand operand by the right-hand a/b will give 2
operand.
% It is used to divide the left-hand operand by the right-hand a%b will give
operand and returns reminder. 0
LAB 7
Creating queries with DML commands,
Operators
o INSERT
o UPDATE
o DELETE
a. INSERT: The INSERT statement is a SQL query. It is used to insert data into the row of a
table.
Syntax:
1. INSERT INTO TABLE_NAME
2. (col1, col2, col3,.... col N)
3. VALUES (value1, value2, value3, .... valueN);
UPDATE: This command is used to update or modify the value of a column in the table.
Syntax:
1. UPDATE table_name SET [column_name1= value1,...column_nameN = valueN] [WHERE CON
DITION]
For example:
1. UPDATE students
2. SET User_Name = 'Sonoo'
3. WHERE Student_Id = '3'
Syntax:
1. DELETE FROM table_name [WHERE condition];
SQL Table
o SQL Table is a collection of data which is organized in terms of rows and columns. In DBMS,
the table is known as relation and row as a tuple.
o Table is a simple form of data storage. A table is also considered as a convenient
representation of relations.
In the above table, "EMPLOYEE" is the table name, "EMP_ID", "EMP_NAME", "CITY",
"PHONE_NO" are the column names. The combination of data of multiple columns forms a
row, e.g., 1, "Kristen", "Washington" and 7289201223 are the data of one row
Operation on Table
1. Create table
2. Drop table
3. Delete table
4. Rename table
LAB 8
Creating and updating Table Views
A view contains rows and columns, just like a real table. The fields in a view are
fields from one or more real tables in the database.
You can add SQL statements and functions to a view and present the data as if the
data were coming from one single table.
CREATE VIEW view_name AS
SELECT column1, column2, ...
FROM table_name
WHERE condition;
CREATE VIEW [Brazil Customers] AS
SELECT CustomerName, ContactName
FROM Customers
WHERE Country = 'Brazil';
The following SQL adds the "City" column to the "Brazil Customers" view:
Example
CREATE OR REPLACE VIEW [Brazil Customers] AS
SELECT CustomerName, ContactName, City
FROM Customers
WHERE Country = 'Brazil';
LAB 9
Introduction SQL Report writing tool
he following table lists the available tools for administering the report server that is
deployed in native mode.
Managing jobs
LAB 10
Introduction to PL/SQL
PL/SQL is a block structured language that enables developers to combine the power of
SQL with procedural statements.All the statements of a block are passed to oracle engine
all at once which increases processing speed and decreases the traffic.
Basics of PL/SQL
•PL/SQL stands for Procedural Language extensions to the Structured Query Language
(SQL).
PL/SQL is a combination of SQL along with the procedural features of programming
languages.
Oracle uses a PL/SQL engine to processes the PL/SQL statements.
PL/SQL includes procedural language elements like conditions and loops. It allows
declaration of constants and variables, procedures and functions, types and variable of
those types and triggers.
Disadvantages of SQL:
SQL doesn’t provide the programmers with a technique of condition checking, looping
and branching.
SQL statements are passed to Oracle engine one at a time which increases traffic and
decreases speed.
SQL has no facility of error checking during manipulation of data.
Features of PL/SQL:
1. PL/SQL is basically a procedural language, which provides the functionality of decision
making, iteration and many more features of procedural programming languages.
2. PL/SQL can execute a number of queries in one block using single command.
3. One can create a PL/SQL unit such as procedures, functions, packages, triggers, and
types, which are stored in the database for reuse by applications.
4. PL/SQL provides a feature to handle the exception which occurs in PL/SQL block
known as exception handling block.
5. Applications written in PL/SQL are portable to computer hardware or operating system
where Oracle is operational.
6. PL/SQL Offers extensive error checking.
other.
Typically, each block performs a logical action in the program. A block has the following
structure:
DECLARE
declaration statements;
BEGIN
executable statements
EXCEPTIONS
exception handling statements
END;