0% found this document useful (0 votes)
6 views4 pages

Final

Uploaded by

Khaled Al zaky
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

Final

Uploaded by

Khaled Al zaky
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Explain the DBMS.

Is a system that is used to manage the database and it is working as


interface to perform various operations like database creation, storing
data in it, updating data, creating a table in the database and a lot more,
and it provides protection and security to the database. In the case of
multiple users, it also maintains data consistency. For example, Oracle
Database.

Explain the RDBMS.

In a relational database, data is stored in one or more tables (or "relations") of columns and
rows, making it simple to see and comprehend how various data structures relate to one
another. Data is organized in relational databases according to predetermined relationships.

RDBMS is a program used to create, update, and manage relational databases. For example,
MySQL

Explain the SQL


SQL stands for Structured Query Language, it is a language that is used to retrieve, update,
delete, add and manipulate data in the database. For example, we have SELECT syntax is
used to retrieve data from the database.

List and explain the different types of JOIN clauses supported in ANSI-
standard SQL. Support with example.
There are six types of join in SQL:

1- The INNER JOIN keyword selects records that have matching values in both tables.
SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name = table2.column_name;
2- The LEFT JOIN keyword returns all records from the left table (table1), and the
matching records from the right table (table2).
SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name = table2.column_name;
3- The RIGHT JOIN keyword returns all records from the right table (table2), and the
matching records from the left table (table1).
SELECT column_name(s)
FROM table1
RIGHT JOIN table2
ON table1.column_name = table2.column_name;
4- The FULL OUTER JOIN keyword returns all records when there is a match in left
(table1) or right (table2) table records.
SELECT column_name(s)
FROM table1
FULL OUTER JOIN table2
ON table1.column_name = table2.column_name
WHERE condition;
5- CROSS JOIN: Returns all records where each row from the first table is combined
with each row from the second table.
SELECT ColumnName_1,
ColumnName_2,
ColumnName_N
FROM [Table_1]
CROSS JOIN [Table_2]
6- A self-join is a regular join, but the table is joined with itself.
SELECT column_name(s)
FROM table1 T1, table1 T2
WHERE condition;

Write a query to get the list of users who took a training lesson more
than once on the same day, grouped by user and training lesson, each
ordered from the most recent lesson date to the oldest date.
SELECT
s.user_id, training_date, username, training_id,
count( user_training_id ) AS num

FROM
users s JOIN training_details d ON d.user_id = s.user_id

GROUP BY
s.user_id, username, training_id, training_date

HAVING
count( user_training_id ) > 1
ORDER BY training_date DESC;

Explain Briefly About MYSQL Database Architecture.


The MYSQL architecture explains the connections between the various parts of the MYSQL
system. Client-Server architecture is used by MySQL. It is set up so that clients, who are end
users, can utilize a variety of networking services to access the server computer's resources.
The major layers of the MySQL architecture are as follows:
 Client
 Server
 Storage Layer

Client Layer:

This layer is the topmost layer in the above diagram. The Client gives request instructions to
the Serve with the help of Client Layer. The Client make request through Command Prompt
or through GUI screen by using valid MYSQL commands and expressions, Some important
services of client layer are :
 Connection Handling.
 Authentication.
 Security.

Server Layer:
The second layer of MYSQL architecture is responsible for all logical functionalities of
relational database management system of MYSQL. This Layer of MYSQL System is also
known as “Brain of MYSQL Architecture”. When the Client give request instructions to the
Server and the server gives the output as soon as the instruction is matched.

Storage Layer:
This Storage Engine Layer of MYSQL Architecture make it’s unique and most preferable for
developers. Due to this Layer MYSQL layer is counted as the mostly used RDBMS and is
widely used. In MYSQL server, for different situations and requirement’s different types of
storage engines are used which are InnoDB ,MYiSAM , NDB ,Memory etc. These storage
engines are used as pluggable storage engineer where tables created by user are plugged
with them.

Explain The Phases of SQL Execution.


Phase 1:
Parser: During parse call, the database performs the following checks- Syntax check,
Semantic check, and Shared pool check, after converting the query into relational algebra.

Syntax check – concludes SQL syntactic validity

Semantic check – determines whether the statement is meaningful or not.

shared Pool check – Every query possess a hash code during its execution. So, this check
determines existence of written hash code in shared pool if code exists in shared pool then
database will not take additional steps for optimization and execution.

Phase 2:
Optimizer: During optimization stage, database must perform a hard parse atleast for one
unique DML statement and perform optimization during this parse. This database never
optimizes DDL unless it includes a DML component such as subquery that require
optimization.
Row Source Generation –
The Row Source Generation is a software that receives a optimal execution plan from the
optimizer and produces an iterative execution plan that is usable by the rest of the database.

Phase 3:
Execution Engine: Finally runs the query and display the required result

You might also like