You are on page 1of 4

Green University of Bangladesh

Department of Computer Science and Engineering (CSE)


Faculty of Sciences and Engineering
Semester: (Fall, Year:2023), B.Sc. in CSE (Day)

Lab Report No. #05


Course Title: Database Lab
Course Code: CSE-210 Section: 213-D11

Student Details

Name ID

1. Md. Tasnimur Rahman Shakir 221902285

Submission Date : 14.12.2023


Course Teacher’s Name : Md. Noyan Ali

Lab Report Status


Marks: ………………………………… Signature:.....................
Comments:.............................................. Date:..............................
1. TITLE OF THE LAB REPORT EXPERIMENT
Querying and Filtering data in MySQL Table

2. OBJECTIVES/AIM
• To gather knowledge about Querying and filtering data in MySQL table.
• To implement distinct and filtering data commands in MySQL table.
3. PROCEDURE / ANALYSIS / DESIGN
The SQL DISTINCT keyword is used with the SELECT statement to eliminate all the duplicate
records and fetch only unique records. There may be a situation when you have multiple duplicate
records in a table. While fetching such records, it makes more sense to fetch only those unique
records instead of fetching duplicate records.
The SQL WHERE clause is used to specify a condition while fetching the data from a single table
or by joining with multiple tables. If the given condition is satisfied, then only it returns a specific
value from the table.
4. IMPLEMENTATION
Question 1:
Input multiple data in any existing database table from previous lab report.

Query:

INSERT INTO branch (branch_name, branch_city, assets) VALUES ('Pollobi', 'Dhaka',


1000000), ('Uttora', 'Dhaka', 750000), ('Boshundhora', 'Dhaka', 600000);
INSERT INTO customer (customer_id, customer_name, customer_city) VALUES (1, 'Tasnim'
, 'Boshundhora'‘tasnim@gmail.com’), (2, 'Mustakim', 'Pollobi',‘mustakim@gmail.com’),
(3, 'Nur', 'Uttora',‘nur@gmail.com’),VALUES (4,'Tasnim','Pollobi',
‘tasnimur@gmail.com’);
INSERT INTO account (account_number, branch_name, balance) VALUES (101, 'Pollobi',
50000), (102, 'Uttora', 7500), (103, 'Boshundhora', 12000);
INSERT INTO loan (loan_number, branch_name, amount) VALUES (201, 'Pollobi', 30000),
(202, 'Uttora', 15000), (203, 'Boshundhora', 25000);
INSERT INTO depositor (customer_name, account_number) VALUES ('Tasnim', 101),
('Mustakim', 102), ('Nur', 103);
INSERT INTO borrower (customer_name, loan_number) VALUES ('Tasnim', 201),
('Mustakim', 202), ('Nur', 203);

Question 2: Query with primary key, query with condition, query with comparison operation.
Query:
SELECT customer_name, Email FROM `customer` ;
SELECT DISTINCT customer_id, customer_name FROM `customer` ;
SELECT loan_number, branch_name FROM `loan` WHERE amount > 15000;
SELECT loan_number, branch_name, amount FROM `loan` WHERE amount <> 25000;
SELECT Email FROM `customer` WHERE customer_name = 'Tasnim';
5. TEST RESULT / OUTPUT

Showing Inserted data of each Table of question 1:


Showing output from the query of question 2:

6. Discussion
Based on the focused objective(s) to understand about the knowledge of SELECT, WHERE and DISTINCT
commands. The additional lab exercise made me more confident towards the fulfilment of the objectives(s)

You might also like