You are on page 1of 14

Q1) DISCUSS THE CHARACTERISTICS OF SQL IN BRIEF.

ANS: -
THE BASIC CHARACTERISTICS OF SQL ARE: -
1) EASY TO LEARN: -
SQL is an extremely practical and user-friendly language. Even if you
have no prior experience with technology, you can learn the basics of
the language. SQL has a syntax that is remarkably close to English,
resulting in a smooth learning curve.

2) WIDE VARIETY OF COMMANDS: -


SQL supports a wide variety of commands such as DDL (Data
Definition Language) commands like CREATE, DROP, ALTER; DML
(Data Manipulation Language) commands like INSERT, UPDATE,
DELETE; DCL (Data Control Language) commands like GRANT,
REVOKE; TCL (Transaction Control Language) commands like
COMMIT, ROLLBACK, and DQL (Data Query Language) commands
like SELECT.

3) STORED PROCEIDURES: -
A stored procedure is a piece of SQL code that you can save and
reuse any number of times. Stored Procedures are used to carry out
one or more DML operations on a database. It’s just a collection of
SQL statements that take some input in the form of arguments,
perform some work, and may or may not return a result.

4) PORTABLE LANGUAGE: -
DQL provides portability of data definitions and applications. That is,
applications can be moved from one machine to another.

5) BEST SUIT FOR CLIENT SERVER ENVIRONMENT: -


SQL is well suited to a client-server environment, in which the
database management system (DBMS) is located on a server and
handles client requests.
6) INTEGRATION: -
Using a connected server, SQL Server can connect to a non-SQL
Server database. The linked server mechanism can connect SQL
Server to third-party backends like Oracle, MySQL, and Salesforce
using a piece of middleware known as an ODBC driver. A JDBC driver
is a Java database’s counterpart of an ODBC driver. It can also be
combined with various scripting languages.

7) HIGH PERFORMANCE: -
In large database systems, SQL provides performance programming
capabilities for highly transactional heavy workloads.

8) SCALABILITY AND FLEXIBILITY: -


SQL is a scalable and flexible database. It’s simple to build new tables, and
tables that have already been created or those which are no longer in use
can be dropped or deleted from a database. SQL is capable of handling big
data sets and several transactions.

9) TRANSACTION: -
TCL, which supports a variety of transactions, is supported by SQL.
Transactions are logically ordered units or sequences of work that
can be completed manually by a human or automatically by a
database application. SQL commands such as COMMIT, ROLLBACK,
SAVEPOINT, and others support transactions.

10) SECURITY: -
SQL allows setting permissions in views, tables, and procedures. This
ensures the safety of data in sensitive databases. Also, constraints
can be specified in SQL. These are rules that limit the types of data
that can be entered into a table column.
Q2) Write the SQL expressions for the following queries with respect
to above tables and paste the output in the answer sheet.
1) Create five rows in the two tables. (Done).

2) Find names of all employees who work for the “Accounts”


Department.

3) For each employee, retrieve the employee’s name and name of


his/her supervisor.
4) How many employees work in the “Accounts” department?

5) What is the maximum, minimum, and average salary in the “Accounts”


department?
6) Retrieve the department names for each department in which more than
two employees work.

7) Modify the database so that “Michael” is assigned to the “Account”


department.

8) Give all employees of “Sales” department a 10% rise in salary.


9) Delete all rows for employees of “Apprentice” department.

11) List down the Emp_Name starting with the letter ‘S’.
Q3) There is a table named PEOPLE that has four
Columns:

Write the following SQL Queries: -


1) List the countries that have at least 50,00,00,000 people [SHOW
COUNTRY, POPULATION].
ANS:
QUERY: - SELECT POPULATION, COUNTRY
FROM PEOPLE
WHERE POPULATION>=50000000;
2) Identify the countries, which have the word “United” included in their
names.
ANS:
QUERY: -
SELECT COUNTY FROM PEOPLE WHERE COUNTRY LIKE
‘UNITED%’;
3) For each continent, show the number of countries with populations
of at least 100 million.

ANS:
QUERY: -
SELECT POPULATION, COUNTRY
FROM PEOPLE
WHERE POPULATION>=100000000;
4) Update the population of India by 10%.

ANS:
QUERY: -

BEFORE QUERY: -

AFTER QYERY: -
UPDATE PEOPLE
SET POPULATION=’13526422800’
WHERE COUNTRY=’INDIA’;
5) Display the country and population more than 20 million.
ANS:
QUERY: -
SELECT POPULATION, COUNTRY
FROM PEOPLE
WHERE POPULATION>20000000;
6) List the name of all countries of continent “ASIA.”
ANS:
QUERY: -
SELECT COUNTRY, CONTINENT FROM PEOPLE WHERE
CONTINENT LIKE ‘ASIA%’;

You might also like