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

dbms

The document provides a comprehensive overview of SQL, including its definition, features, types of commands (DDL, DML, DCL, TCL, DQL), and various data types used in SQL. It also differentiates between DBMS and RDBMS, explains the purpose of specific SQL commands, and includes practical exercises for implementing SQL commands such as creating tables, inserting data, and querying records. Additionally, it discusses constraints in SQL and their importance in maintaining data integrity.

Uploaded by

hmpthmcrtc
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)
1 views

dbms

The document provides a comprehensive overview of SQL, including its definition, features, types of commands (DDL, DML, DCL, TCL, DQL), and various data types used in SQL. It also differentiates between DBMS and RDBMS, explains the purpose of specific SQL commands, and includes practical exercises for implementing SQL commands such as creating tables, inserting data, and querying records. Additionally, it discusses constraints in SQL and their importance in maintaining data integrity.

Uploaded by

hmpthmcrtc
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/ 35

Bachelor of Computer Science and

Engineering
Course Name: Database Management
Systems Lab
Course Code: 13020441

Submitted to:
Submitted by:
Dr. Jyoti Godara
Name: Divyajeet
Assistant Professor
Reg No. 221302105

Department of Computer Science & Engineering

Faculty of Engineering and Technology


Practical 1: Learning basics of SQL

1. What is SQL? State features of SQL.


Ans. SQL stands for Structured Query Language. It’s a standard
programming language used to access, organize, and manipulate data stored
in relational databases. SQL is a database language that can perform
activities on databases that consist of tables made up of rows and columns.
Features of SQL:
=> Exceptional Error-Handling
=> Transaction Control
=> Data Integrity
=> User Access Control
=> Portability
2. Discuss different types of SQL commands.
Ans. Based on functionality perform by them, there are five types of SQL
Commands.
=> Data Definition Language(DDL):

o DDL changes the structure of the table like creating a table, deleting a
table, altering a table, etc.
o All the command of DDL are auto-committed that means it permanently
save all the changes in the database.

Here are some commands that come under DDL:

o CREATE
o ALTER
o DROP
o TRUNCATE

=> Data Manipulation Language(DML):


o DML commands are used to modify the database. It is responsible for all
form of changes in the database.
o The command of DML is not auto-committed that means it can't
permanently save all the changes in the database. They can be rollback.

Here are some commands that come under DML:

o INSERT
o UPDATE
o DELETE

=> Data Control Language(DCL):


DCL commands are used to grant and take back authority from any database
user.
Here are some commands that come under DCL:

o Grant
o Revoke

=> Transaction Control Language(TCL):

TCL commands can only use with DML commands like INSERT, DELETE
and UPDATE only.

These operations are automatically committed in the database that's why they
cannot be used while creating tables or dropping them.

Here are some commands that come under TCL:

o COMMIT
o ROLLBACK
o SAVEPOINT

=> Data Query Language(DQL):

DQL is used to fetch the data from the database.

It uses only one command:


o SELECT

3. What are various data types used in SQL?


Ans. A data type is an attribute that specifies the type of data that the object can
hold:
Numeric Types:
 INTEGER
 FLOAT
 DOUBLE
 DECIMAL/NUMERIC
 SMALLINT
Character String Types:
 CHAR(n)
 VARCHAR(n)
 TEXT
 VARCHAR(MAX)
Date and Time Types:
 DATE
 TIME
 DATETIME
 TIMESTAMP

4. Differentiate between DBMS and RDBMS.


Ans. Here are some differences between DBMS and RDBMS:

DBMS stores data as file. RDBMS stores data in tabular form.


Data elements need to access Multiple data elements can be
individually. accessed at the same time.

Data is stored in the form of tables


No relationship between data.
which are related to each other.

Normalization is not present. Normalization is present.

DBMS does not support distributed RDBMS supports distributed


database. database.

It uses a tabular structure where the


It stores data in either a navigational headers are the column names, and
or hierarchical form. the rows contain corresponding
values.

It deals with small quantity of data. It deals with large amount of data.

Data redundancy is common in this Keys and indexes do not allow Data
model. redundancy.

It is used for small organization and It is used to handle large amount of


deal with small data. data.
Not all Codd rules are satisfied. All 12 Codd rules are satisfied.

Security is less More security measures provided.

It supports single user. It supports multiple users.

Data fetching is slower for the large Data fetching is fast because of
amount of data. relational approach.

The data in a DBMS is subject to


There exists multiple levels of data
low security levels with regards to
security in a RDBMS.
data manipulation.

Low software and hardware Higher software and hardware


necessities. necessities.

Examples: MySQL, PostgreSQL, S


Examples: XML, Window Registry,
QL Server, Oracle, Microsoft
Forxpro, dbaseIIIplus etc.
Access etc.

5. State purpose of following commands:


i. Create Table
ii. Describe
iii. Insert
iv. Delete
v. Update
vi. Alter Table
vii. Select
viii. Drop
ix. Truncate

Ans. Here's the purpose of each SQL command:


i. **Create Table**:
- Purpose: Creates a new table in the database with specified columns and
their data types.
ii. **Describe**:
- Purpose: Provides metadata about a table, such as column names, data
types, constraints, and indexes.
iii. **Insert**:
- Purpose: Adds one or more new rows of data into an existing table.
iv. **Delete**:
- Purpose: Removes one or more rows of data from an existing table based
on specified conditions.
v. **Update**:
- Purpose: Modifies existing data within a table by changing the values of
one or more columns in one or more rows.
vi. **Alter Table**:
- Purpose: Modifies the structure of an existing table, such as adding or
dropping columns, modifying column data types, or adding constraints.
vii. **Select**:
- Purpose: Retrieves data from one or more tables based on specified
criteria, allowing filtering, sorting, and grouping of data.
viii. **Drop**:
- Purpose: Deletes an existing database object, such as a table, index, or
view, from the database.
ix. **Truncate**:
- Purpose: Removes all rows from a table, effectively resetting the table to
its initial state, but keeps the table structure intact.
Practical 2: Implementation of Create Table, Describe, Insert, Update,
Delete, Drop Table and Select Commands.
1. Create the table client_master with following specifications.

Table Name: client_master


Column Name Data Type Size
Client_no Varchar2 6
Name Varchar2 20
City Varchar2 15
Pincode Number 8
State Varchar2 15
Balance Number 10,2

Query:
create table client_master(
Client_No varchar(6),
Name varchar(20),
City varchar(15),
Pincode number(8),
State varchar(15),
Balance number(10,2));
Output:

2. Insert data in client_master as given in table below.

Client_no name city Pincode state Balance


C00001 Ivan Mumbai 400054 Maharashtra 15000
Bayross
C00002 Vandana Madras 780001 Tamil Nadu 0
C00003 Pramada Mumbai 400057 Maharashtra 5000
C00004 Sachin Mumbai 400056 Maharashtra 0
C00005 Ravi Delhi 100001 null 2000
C00006 Rukmini Madras 400050 Tamil Nadu 0

Query:
Insert into client_master values(‘C00001’, ‘Ivan Bayross’, ‘Mumbai’, 400054,
‘Maharashtra’, 15000);
Insert into client_master values(‘C00002’, ‘Vandana’, ‘Madras’, 780001, ‘Tamil
Nadu’, 0);
Insert into client_master values(‘C00003’, ‘Pramada’, ‘Mumbai’, 400057,
‘Maharashtra’, 5000);
Insert into client_master values(‘C00004, ‘Sachin’, ‘Mumbai’, 400056,
‘Maharashtra’, 0);
Insert into client_master values(‘C00005’, ‘Ravi’, ‘Delhi’, 100001, null, 2000);
Insert into client_master values(‘C00006’, ‘Rukmini’, ‘Madras’, 400050, ‘Tamil
Nadu’, 0);
Output:

3. Show the structure of table Client_master.

Query:

Desc client_master;

Output:
4. Show all records of client_master.

Query:

Select * from client_master;

Output:

5. Update balance of Sachin to 3500.

Query:

Update client_master set Balance = 3500 where name = ‘Sachin’;

Output:
6. Delete record of client C00006.

Query:

Delete from client_master where client_no = ‘C00006’;

Output:

7. Show records of clients having balance greater than 2000.

Query:

Select * from client_master where balance > 2000;

Output:

8. Show records of clients staying in Mumbai or Madras.

Query:
Select * from client_master where city = ‘Mumbai’ or city = ‘Madras’;

Output:

9. Update city, pincode and state of Pramada to Madras, 780001, Tamil


Nadu.

Query:

Update client_master set city = ‘Madras’, pincode = 780001, state = ‘Tamil


Nadu’ where name = ‘Pramada’;

Output:

10.Show name, city and state of all the clients.

Query:

Select name, city, state from client_master;

Output:
11.Display client_no, name, balance of clients staying in Mumbai.

Query:

Select client_no, name, balance from client_master where city = ‘Mumbai’;

Output:

12.Display City and Balance of Vandana.

Query:

Select city, balance from client_master where name = ‘Vandana’;

Output:

13.Drop your student table.

Query:

Drop table student;

Output:
14.Find out the names of all the clients.

Query:

Select name from client_master;

Output:

15.Discuss the use of Truncate command.

Ans. TRUNCATE is a Data Definition Language(DDL) operation that is used to


mark the extent of a table for deallocation. It is a command that is used to delete
all the rows or tuples from a table. Unlike the DELETE command, the
TRUNCATE command does not contain a WHERE clause.

16.Explain various data-types of Oracle.

Ans. Oracle Database offers a rich set of data types to store different types of
data efficiently. Here's an explanation of various data types available in
Oracle:

**Character Data Types**:

- **CHAR**: Fixed-length character string with a maximum size of 2000


bytes.

- **VARCHAR2**: Variable-length character string with a maximum size


of 4000 bytes.

- **NCHAR**: Fixed-length Unicode character string with a maximum


size of 2000 bytes.

- **NVARCHAR2**: Variable-length Unicode character string with a


maximum size of 4000 bytes.
**Numeric Data Types**:

- **NUMBER**: Fixed-point or floating-point number with a precision


and scale specified by the user.

- **INTEGER**: Whole number data type with a range of -2^31 to 2^31 -


1.

- **FLOAT**: Floating-point number with a binary precision.

- **REAL**: Single-precision floating-point number.

**Date and Time Data Types**:

- **DATE**: Stores date and time values with a precision of one second.

- **TIMESTAMP**: Stores date and time values with fractional seconds


precision.

- **INTERVAL YEAR TO MONTH**: Stores a period of time measured


in years and months.

- **INTERVAL DAY TO SECOND**: Stores a period of time measured in


days, hours, minutes, and seconds.

**Binary Data Types**:

- **BLOB**: Binary Large Object for storing large binary data like
images or documents.

- **CLOB**: Character Large Object for storing large character data like
text documents.

- **BFILE**: Pointer to a binary file stored outside the database.

**Rowid Data Type**:

- **ROWID**: Unique identifier for a row in a table.

**Boolean Data Type**:

- **BOOLEAN**: Represents true or false values.

**XML Data Type**:

- **XMLTYPE**: Stores XML data.


**User-Defined Types**:

- **OBJECT**: User-defined data type representing an object with


attributes and methods.

- **VARRAY**: Variable-size array type.

- **Nested Table**: Collection type that can hold an unspecified number


of elements.
Practical 3: Implementation of Create Table, Alter Table and Select query
with Like and Between Predicate.
1. Create table Product with following specifications.

Table Name: Product


Column Name Data type Size
Product_no Varchar2 6

Description Varchar2 15
Profit Number 4,2
Quantity Number 8
Sell_price Number 8,2
Cost_price Number 8,2
Query:
Create table Product(
Product_no varchar(6),
Description varchar(15),
Profit number(4,2),
Quantity number(8),
Sell_price number(8,2),
Cost_price number(8,2));
Output:
2. Insert data in Product as given in table below.

Product_no Description Profit Quantity Sell_price Cost_price


P00001 Hard Disk 5 100 4500 4000
P03453 Monitors 6 10 12000 11280
P06734 Mouse 5 20 1050 1000
P07865 Pen Drive 5 100 345 325
P07868 Keyboards 2 10 3150 3050
Query:
insert into Product(Product_no, Description, Profit, Quantity, Sell_price,
Cost_price)
values
('P00001','Hard Disk',5,100,4500,4000),
('P03453','Monitors', 6, 10, 12000,11280),
('P06734', 'Mouse', 5, 20, 1050, 1000),
('P07865', 'Pen Drive', 5, 100, 345, 325),
('P07865', 'Keyboards', 2, 10, 3150, 3050);
Output:

3. Add new column Category (datatype Varchar, size 20) to product


table.

Query:
Alter table Product
Add Category varchar(20);
Output:
4. Insert category value as ‘Input’ or ‘Storage’ or ‘Output’

Query:
Update Product set category = ‘Input’ where Description = ‘Mouse’ or
Description = ‘Keyboards’;
Update Product set category = ‘Storage’ where Description = ‘Hard Disk’ or
Description = ‘Pen Drive’;
Update Product set category = ‘Output’ where Description = ‘Monitors’;
Output:

5. Modify size of description column to 20.

Query:
Alter table Product
Modify Description varchar(20);
Output:

6. Show all records of Product table.

Query:
Select * from Product;
Output:
7. Show all products whose selling price is less than 1000.

Query:
Select * from Product where sell_price < 1000;
Output:

8. List all records from product table for products whose description
second character is either ‘a’ and ‘e’.

Query:
Select * from Product where Description like(‘_a%’) or Description like(‘_e%);
Output:

9. List all products having selling price between 2000 and 4000 and cost
price is greater than 1000.

Query:
Select * from Product where sell_price between 2000 and 4000 and cost_price >
1000;
Output:
Practical 4: Working with constraints.
1. Define constraints. Discuss all constraints in SQL.
Ans. 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.
Constraints can be column level or table level. Column level constraints apply to a
column, and table level constraints apply to the whole table.
The following constraints are commonly used in SQL:
 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 links between tables.
 CHECK => Ensures that eh values in a column satisfies a specific condition
 DEFAULT => Sets a default value for a column if no value is specified
2. Explain difference between following:
 Unique and Primary Key Constraint
 Table Level and Column Level Constraints
 Not Null and Primary Key Constraint
Ans.
Differences:
 Unique and Primary Key Constraint:
 Unique Constraint: Ensures that all values in a column are unique. Multiple columns
can have unique constraints, and NULL values are allowed.
 Primary Key Constraint: A special case of the unique constraint. It uniquely identifies
each record in a table and does not allow NULL values.
 Table Level and Column Level Constraints:
 Table Level Constraints: Apply to the entire table and can reference multiple columns
in the table.
 Column Level Constraints: Apply only to the column in which they are defined.
 Not Null and Primary Key Constraint:
 NOT NULL Constraint: Ensures that a column cannot have NULL values.
 Primary Key Constraint: Ensures the uniqueness of a column or a set of columns and
also implies that the column(s) cannot have NULL values.

3. Create table New_Prod_master with following Specifications.


Column Name Data type Size Constraints

Product_no Varchar2 6 Primary Key/first letter


must start with ‘P’
Description Varchar2 15 Not Null

Profit Number 4,2 Not Null

Quantity Number 8 Not Null

Sell_price Number 8,2 Not Null, cannot be0

Cost_price Number 8,2 Not Null, cannot be 0

Query:
Create table New_Prod_master(
Product_no varchar(6) Check(Product_no like ‘P%’) Primary Key,
Description varchar(15) Not Null,
Profit number(4,2) Not Null,
Quantity number(8) Not Null,
Sell_price number(8,2) Not Null Check(Sell_price <>0),
Cost_price number(8,2) Not Null Check(Cost_price <>0));

Output:

4. Insert data in New_Prod_master as given in table below.

Product_no Description Profit Quantity Sell_price Cost_price


P00001 Hard Disk 5 100 4500 4000
P03453 Monitors 6 10 12000 11280
P06734 Mouse 5 20 1050 1000
P07865 Pen Drive 5 100 345 325
P07868 Keyboards 2 10 3150 3050

Query:
Insert into New_Prod_master (Product_no, Description, Profit, Quantity, Sell_price,
Cost_price)
Values
(‘P00001’, ‘Hard Disk’, 5, 100, 4500, 4000),
(‘P03453’, ‘Monitors’, 6, 10, 12000, 11280),
(‘P06734’, ‘Mouse’, 5, 20, 1050, 1000),
(‘P07865’,’Pen Drive’, 5, 100,345,325),
(‘P07868’, ‘Keyboards’, 2,10,3150,3050);
Output:

5. Change Product_no of keyboards to P07865. Which error message is displayed by


Oracle?

Query:

Update New_Prod_master set product_no = ‘P07865’ where Description = ‘Keyboards’;

Output:

6. Change the cost price of pen drive to 370 and quantity to 200.
Query:
Update New_Prod_master set Cost_price = 370, Quantity = 200 where Description = ‘Pen
Drive’;

Output:

7. Apply constraints to any existing table through Alter table command.


Query:
Alter table client_master add CONSTRAINT pk_client Primary Key Client_No;
Output:

Practical 5: Working with Foreign Key Constraint and Constraint names.


1. Create table Persons with following Specifications.
Column Name Data type Size Constraints

PersonId int 2 Primary Key

LastName Varchar2 15 Not Null

FirstName Varchar2 15 Not Null

Age int 2 Not Null

Query:
Create table Persons(
PersonId int(2) Primary Key,
LastName Varchar(15) Not Null,
FirstName Varchar(15) Not Null,
Age int(2) Not Null);
Output:

2. Insert data in Persons as given in table below.


Persons Table

PersonID LastName FirstName Age


1 Hansen Ola 30
2 Svendson Tove 23
3 Pettersen Kari 20

Query:
Insert into Persons (PersonId, LastName, FirstName, Age)
Values
(1, ‘Hansen’, ‘Ola’, 30),
(2, ‘Syendson’, ‘Tove’, 23),
(3, ‘Pettersen’, ‘Kari’, 20);
Output:

3. Now create table Orders


Column Name Data type Size Constraints

OrderID int 2 Primary Key

OrderNumber int 6 Not Null

PersonId int 2 Foreign Key(Refer


table Persons)
Item Varchar 20 ‘cotton’ or ‘scissor’ or
‘paper’ or ‘tape’

Query:
Create table Orders(
OrderId int(2) Primary Key,
OrderNumber int(6) Not Null,
PersonId int(2),
Item Varchar(20) Check(Item In (‘cotton’, ‘scissor’, ‘paper’, ‘tape’)),
Foreign Key (PersonId) References Persons(PersonId));
Output:

4. Insert data in Orders as given in table below.

Orders Table

OrderID OrderNumber Item PersonID


1 77895 cotton 3
2 44678 cotton 3
3 22456 paper 2
4 24562 tape 1
5 50621 scissor Null

Query:
Insert into Orders (OrderId, OrderNumber, Item, PersonId)
Values
(1, 77895, ‘cotton’, 3),
(2, 44678, ‘cotton’, 3),
(3, 22456, ‘paper’, 2),
(4, 24562, ‘tape’, 1),
(5, 50621, ‘scissor’, Null));
Output:

5. Change personid of Pettersen to 4. Does it impact the table Orders?


Query:
Update Persons
Set PersonId = 4
Where LastName = ‘Pettersen’;
Output:

6. List all ordernumbers for item cotton or scissor


Query:
Select OrderNumber
From Orders
Where Item In(‘cotton’, ‘scissor’);
Output:

7. Insert new record in Orders table with values - OrderID - 6, OrderNumber -45673, Item
-tape , PersonID -2.
Query:
Insert into Orders (OrderId, OrderNumber, Item, PersonId)
Values(6,45673, ‘tape’, 2);
Output:
8. Give one example of Alter Table command for implementation of Primary Key, Not null
and Foreign Key.
Implementation of Primary Key using alter table command

Implementation of Not Null using alter table command

Implementation of Foreign Key using alter table command


Practical 5: Working with SQL inbuilt functions.

2. Discuss use and syntax all aggregate functions, five string and date functions.
Aggregate Functions:
1) Count(): Counts the number of rows in a specified column or all rows in a table.
Syntax: ‘Count(expression)’ or ‘Count(*)’ for all rows.
2) Sum(): Calculates the sum of values in a specified column.
Syntax: ‘Sum(expression)’
3) Avg(): Calculates the average of values in a specified column.
Syntax: ‘Avg(expression)’
4) Min(): Finds the minimum value in a specified column.
Syntax: ‘Min(expression)’
5) Max(): Finds the maximum value in a specified column.
Syntax: ‘Max(expression)’

String Functions:
1) Concat(): Concatenates two or more strings into one.
Syntax: ‘Concat(string1, string2, ….)’
2) Upper(): Converts a string to uppercase.
Syntax: ‘Upper(string)’
3) Lower(): Converts a string to lowercase.
Syntax: ‘Lower(string)’
4) Length(): Returns the length of a string.
Syntax: ‘Length(string)’
5) SubString(): Extracts a substring from a string.
Syntax: ‘SubString(string, start, length)’

Date Functions:
1) Current_date(): Returns the current date.
Syntax: ‘Current_date()’
2) Current_time(): Returns the current time.
Syntax: ‘Current_time()’
3) Current_timestamp(): Returns the current timestamp.
Syntax: ‘Current_timestamp()’
4) Date_Add(): Adds a specified interval to a date.
Syntax: ‘Date_add(date, Interval value unit)’
5) Datediff(): Calculates the difference between two dates.
Syntax: ‘Datediff(end_date, start_date)’

3. Give example of “Distinct” and “All” keyword with aggregate function.

Distinct with Aggregate Function(Count):

All with Aggregate Function(Sum):

4. Create table Orders with following rows:

OrderId ProductName OrderDate


1 Geitost 2008-11-11

2 Camembert Pierrot 2008-11-09

3 Mozzarella di Giovanni 2008-11-11

4 Mascarpone Fabioli 2008-10-29

Query:
create table Orders(
OrderId int,
ProductName varchar(30),
OrderDate date);

insert into Orders( OrderId, ProductName, OrderDate)


values
(1, 'Geitost', '2008-11-11'),
(2, 'Camembert Pierrot', '2008-11-09'),
(3, 'Mozzarella di Giovanni', '2008-11-11'),
(4, 'Mascarpone Fabioli', '2008-10-29');
Output:

2. Display the records for dates “2008-11-11” or “2008-10-29”


Query:
Select * from Orders
Where OrderDate = ‘2018-11-11’ or OrderDate = ‘2008-10-29’;
Output:
3. Extract the date part for all rows.
Query:
Select date(OrderDate) as Date from Orders;
Output:

4. Create Table: product_spend and insert the given data

category product user_id spend transaction_date


219.8
appliance washing machine 123 03/02/2022 11:00:00
0
electronic 152.0
vacuum 178 04/05/2022 10:00:00
s 0
electronic 249.9
wireless headset 156 07/08/2022 10:00:00
s 0
electronic 189.0
vacuum 145 07/15/2022 10:00:00
s 0
electronic
computer mouse 195 45.00 07/01/2022 11:00:00
s
246.0
appliance refrigerator 165 12/26/2021 12:00:00
0

Query:
Create table Product_Spend(
Category varchar(20),
Product varchar(30),
User_id int,
Spend decimal(10,2),
Transaction_Date datetime
);

Insert into Product_Spend(Category, Product, user_id, Spend, Transaction_date)


Values
(‘Appliance’, ‘Washing Machine’, 123, 219.80, ‘2022-03-02 11:00:00’),
(‘Electronics’, ‘Vacuum’, 178, 152.00, ‘2022-04-05 10:00:00’),
(‘Electronics’, ‘Wireless Headset’, 156, 249.90, ‘2022-07-08 10:00:00’),
(‘Electronics’, ‘Vacuum’, 145, 189.00, ‘2022-07-15 10:00:00’),
(‘Electronics’, ‘Computer Mouse’, 195, 45.00, ‘2022-07-01 11:00:00’),
(‘Appliance’, ‘Refrigerator’, 165, 246.00, ‘2021-12-26 12:00:00’);
Output:

5. Give count of number of products purchased.


Query:
select Category, Count(Product) from Product_Spend group by category;
select Count(Product) from Product_Spend;
Output:

6. What is total sales done?


Query:
Select sum(Spend) as Total_Sales from Product_Spend;
Output:

You might also like