0% found this document useful (0 votes)
18 views

Data Questions

SQL and PL/SQL are database programming languages. SQL is used to communicate with the database and perform tasks like data queries and manipulation. PL/SQL allows for more complex operations like variable declaration, conditional execution, and exception handling. It is helpful for writing stored procedures and triggers. The key difference is that SQL alone cannot perform programming tasks while PL/SQL extends SQL's functionality to include programming constructs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

Data Questions

SQL and PL/SQL are database programming languages. SQL is used to communicate with the database and perform tasks like data queries and manipulation. PL/SQL allows for more complex operations like variable declaration, conditional execution, and exception handling. It is helpful for writing stored procedures and triggers. The key difference is that SQL alone cannot perform programming tasks while PL/SQL extends SQL's functionality to include programming constructs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Data questions

➢ SQL + PL / SQL + Database:-

What are DCL, DML, and DDL in SQL?


DDL (Data Definition Language):
Is used to define structure of database object (create, delete, edit)

Like "CREATE / ALTER/ DROP"

DML (Data Manipulation Language)


DML statements are used for managing data with in schema objects
Like ".select /update /delete/ insert"

DCL (Data Control Language):


Used to control access to data stored in a database (Authorization)
Like "grant/ revoke"

What is the difference between group by and having?


the HAVING clause was added to SQL because the WHERE keyword cannot be used with
aggregate functions.

Difference between Having clause and Group by clause:


Having Clause Group By Clause

The group by clause is


used to group the data
It is used for applying some extra according to particular
1. condition to the query. column or row.

Having can be used without


group by clause, in aggregate Group by can be used
function, in that case it behaves without having clause with
2. like where clause. the select statement.

The having clause can contain It cannot contain aggregate


3. aggregate functions. functions.

It groups the output on


It restrict the query output by basis of some rows or
4. using some conditions columns
What is order by? Can we order more than one column?
The ORDER BY statement in SQL is used to sort the fetched data in either
ascending or descending according to one or more columns.
What is the difference between union and join?
the UNION operator is used to combine the result-set of two or
more SELECT statements
Note: The column names in the result-set are usually equal to
the column names in the first SELECT statement

A JOIN clause is used to combine rows from two or more tables,


based on a related column between them.

What is the difference type of join?


• (INNER) JOIN: Returns records that have matching values in both tables
• LEFT (OUTER) JOIN: Returns all records from the left table, and the
matched records from the right table
• RIGHT (OUTER) JOIN: Returns all records from the right table, and the
matched records from the left table
• FULL (OUTER) JOIN: Returns all records when there is a match in either
left or right table

A self-join is a regular join, but the table is joined with itself.

What are the aggregate functions?


Count /Sum /Avg /Min /Max

What are the SQL statements Sequence?


(Select >> From >> Join >> Where>> group by>> having>> order by)
What is the view? + Why we use it?
is a logical table based on a table or another view
Contains no data of its own “but it’s like a window through which data from tables
can be viewed or changed”
Base tables
View is stored as a select statement in the data dictionary

Uses of a View :
A good database should contain views due to the given reasons:
1. Restricting data access –
Views provide an additional level of table security by restricting
access to a predetermined set of rows and columns of a table.
2. Hiding data complexity –
A view can hide the complexity that exists in a multiple table join.
3. Simplify commands for the user –
Views allows the user to select information from multiple tables
without requiring the users to actually know how to perform a join.
4. Store complex queries –
Views can be used to store complex queries.
5. Rename Columns –
Views can also be used to rename the columns without affecting
the base tables provided the number of columns in view must
match the number of columns specified in select statement. Thus,
renaming helps to hide the names of the columns of the base
tables.
6. Multiple view facility –
Different views can be created on the same table for different
users.

What is the SQL transaction?


A transaction is a logical unit of work that contains one or more SQL statements. A
transaction is an atomic unit. The effects of all the SQL statements in a transaction
can be either all committed (applied to the database) or all rolled back (undone
from the database).
What is the difference between delete and truncate?
=>The DELETE statement is used to delete existing records in a table.
) Here we can use the “ROLLBACK” command to restore the tuple because it does
not auto-commit)
=>DROP TABLE statement is used to drop an existing table in a database.ddl
=>truncate is used to delete all the rows of a relation (table) in one go
(Here we can't use the “ROLLBACK” command to restore the tuple because it does
not auto-commit)
Truncate is faster
The TRUNCATE command does not remove the structure of the table.
How can insert column to the table?
INSERT INTO table_name (column1, column2, column3, ...)
VALUES (value1, value2, value3, ...);
How can insert multi rows in only one insert statement?
Example
INSERT INTO employee_details VALUES
('E40004','SANTHOSH','E102',25),
('E40005','THAMAN','E103',26),
('E40006','HARSH','E101',25),
('E40007','SAMHITH','E102',26);
What is database, DBMS and RDBMS?
Data base: collection of related data
DBMS; Database Management System is a software that is used to define, create
and maintain a database and provides controlled access to the data.
RDBMS: Relational Database Management System is an advanced version of a
DBMS.
What are the kinds of attributes?
▪ Key 🡺An attribute whose values are distinct (unique) for each entity
1. Candidate key 🡺 when an entity has more than one key ---ex: ID W SSN
2. Composite Key 🡺 combination of the attribute values that together form a
key
▪ Simple Attribute 🡺 only can have one value ----- ex: ID
▪ single-Valued Attribute 🡺 can have one value --- ex:- age
▪ Multi-Valued Attribute 🡺 can have more than one value --- ex:- Phone Number
▪ Composite Attribute 🡺 Divided into smaller subparts ---- ex: Address 🡺 Street –
Zone
▪ Derived Attribute 🡺 Calculated from another attribute or entity ----- ex: Age –
Birthdate
▪ Complex Attribute 🡺 Email, Phone number, Address (All are separated by commas
and multi-valued components are represented between curly braces). ----- Ex:
Adrees_EmPhone (You can choose any name).

What is the ERD?


Entity Relationship Modeling: “To make the conceptual design”
Entity-Relationship Diagram (ERD): identifies information required by the business by
displaying the relevant entities and the relationships between them.
(Entity .. attributes … relationship )

What is the type of constraints?

NOT NULL - Ensures that a column cannot have a NULL value

UNIQUE - Ensures that all values in a column are different

PRIMARY KEY - A combination of a NOT NULL and UNIQUE. Uniquely identifies each
row in a table

FOREIGN KEY - Prevents actions that would destroy links between tables

CHECK - Ensures that the values in a column satisfies a specific condition

DEFAULT - Sets a default value for a column if no value is specified

CREATE INDEX - Used to create and retrieve data from the database very quickly

What is the difference between primary key and foreign key?


The UNIQUE constraint ensures that all values in a column are different.

you can have many UNIQUE constraints per table, but only one PRIMARY
KEY constraint per table.

The FOREIGN KEY constraint is used to prevent actions that would destroy links
between tables.

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.

What is delete set null and delete cascade?


ON DELETE CASCADE : SQL Server deletes the rows in the child table that is
corresponding to the row deleted from the parent table.
ON DELETE SET NULL : SQL Server sets the rows in the child table to NULL if
the corresponding rows in the parent table are deleted.
What is the normalization and why are we making it?
Normalization: The process of decomposing unsatisfactory "bad" relations by
breaking up their attributes into smaller relation
▪ to certify the goodness of a design and thus to minimize redundancy and
anomalies (insert, update, delete anomalies)
▪ when acquiring existing database design from previous legacy models, or
from existing files
Normalization Avoids
• Duplication of Data
• Insert Anomaly
• Delete Anomaly
• Update Anomaly
• Frequent Null Values

What are the types of normalization?


▪First Normal form
oMultivalued Attribute – ex: Telephone (x)
oRepeating group – ex: Subject, subject desc. & grade (x)
oComposite Attribute (x
▪Second Normal Form
oFirst Normal Form)√(
oPartial Dependency (x
▪Third Normal Form
oSecond Normal form)√(
oTransitive dependency (x)
What are the update anomalies?
An update anomaly is a data inconsistency that results from data redundancy and a partial
update.
What is the difference between SQL and PL/SQL?
PL/SQL is most helpful put in writing triggers and keeping procedures.
Stored procedures square measure units of procedural code keep during a
compiled type inside the info
Comparisons of SQL and PLSQL:
Sr. Basis of
No. Comparison SQL PL/SQL

It is a database
It is a database programming
Structured Query language using
1. Definition Language. SQL.

Variables,
constraints, and
data types features
Variables are not are available in
2. Variables available in SQL. PL/SQL.

No Supported Control Structures


Control Structures are available like,
like for loop, if, and for loop, while loop,
3. Control structures other. if, and other.

Nature of It is a Data-oriented It is an application-


4. Orientation language. oriented language.

PL/SQL block
performs Group of
Operation as a
single block
Query performs the resulting in
single operation in reduced network
5. Operations SQL. traffic.

Declarative/ PL/SQL is a
Procedural SQL is a declarative procedural
6. Language language. language.
Sr. Basis of
No. Comparison SQL PL/SQL

SQL can be
embedded in PL/SQL can’t be
7. Embed PL/SQL. embedded in SQL.

It directly interacts It does not interact


Interaction with with the database directly with the
8. Server server. database server.

SQL does not PL/SQL provides


Exception provide error and error and exception
9. Handling exception handling. handling.

It is used to write The code blocks,


queries using DDL functions,
(Data Definition procedures
Language) and DML triggers, and
(Data Manipulation packages can be
Language) written using
10. Writes statements. PL/SQL.

SQL does not offer PL/SQL offers a


a high processing high processing
Processing speed for speed for
11. Speed voluminous data. voluminous data.

You can use


You can fetch, alter, PL/SQL to develop
add, delete, or applications that
manipulate data in a show information
database using from SQL in a
12. Application SQL. logical manner.

What are the types of loops in PL/SQL?


What are the cursors and what are the cursors types?
What is the procedure?
What is difference between procedure and function?
What are the triggers and what are the triggers types?
Write SQL Statements
➢ Business Intelligence
What is the Business Intelligence?
Business intelligence (BI) leverages software and services to transform data
into actionable insights that inform an organization’s strategic and tactical
business decisions. BI tools access and analyze data sets and present
analytical findings in reports, summaries, dashboards, graphs, charts and
maps to provide users with detailed intelligence about the state of the
business.

The term business intelligence often also refers to a range of tools that
provide quick, easy-to-digest access to insights about an organization’s
current state, based on available data.
What are the steps in BI?
1) Data warehouse design => data architect
2) Data integration => data engineer
3) Data analyst => data analyst
4) Data reporting => data visualization developer
What are the tools we use in BI (for ETL, Analysis, and
Visualization)?
ETL: talent / oracle/ data bricks/ data stage
Analysis: sql server /sass data mining
Visualization: power bi /excel / Tableau
➢ Data Warehouse
What is the data warehouse?
What are the characteristics of data warehouse?
A data warehouse is a subject oriented, integrated, nonvolatile, and time variant
collection of data in support of management’s decisions.

What is the difference between database and data warehouse?


What is the difference between data warehouse and big data?
Big data =>Zettabyte / Hadoop
(images videos social media )
data warehouse => collection of data from several sources in one place /
excel

What is the difference between OLTP and OLAP?


OLAP is an acronym for : OLAP is an acronym for Online Analytical Processing
Online Analytical Processing and OLTP is an acronym of Online and OLTP is an
acronym of Online Transactional Processing
What is Data Warehousing?
Data Warehousing is the process of constructing and using the data warehouse
What are the processes that can be done on data warehouse?
Data Warehousing involves data cleaning, data integration and data
consolidations.
What is Data Modeling? + Types of Data Modeling?
Data modeling is the process of diagramming data flows
The three primary data model types are relational, dimensional, and entity-relationship
(E-R). There are also several others that are not in general use, including hierarchical,
network, object-oriented, and multi-value.
Can we update a record in data warehouse?
What is data mart?
Data mart contains the subset of organization-wide data. This subset of data is
valuable to specific groups of an organization. In other words, we can say that a
data mart contains data specific groups of an organization. In other words, we
can say that a data mart contains data specific to a particular group.
What is Data Cube?
Data cube helps us to represent the data in multiple dimensions. The data cube
is defined : Data cube helps us to represent the data in multiple dimensions. The
data cube is defined by dimensions and facts. by dimensions and facts.
What is the ETL?
What is the difference between snowflake and star schema?
What is the difference between fact and dimension table?
➢ Big Data
Why is the big data?
What is the big data? (V's of Big Data)
What are the data types?
What is Data Lake?
What is the difference between ETL & ELT?
What is the difference between Database and Big
data?
What are tools in big data?
What are (Hadoop/Spark / Mapreduce / Hive /
impala/ Impala/ Kafka/…)?

You might also like