Untitled Document
Untitled Document
REG.NO: 22BRS1112
1. branch :
BRANCH_NAME BRANCH_CITY ASSETS
Perryridge Rye 5000000
Downtown Stamford 1000000
Brighton Paloalto 2500000
Redwood Harrison 1500000
Mianus Pitsfield 4500000
Roundhill Princeton 1500000
3. loan :
LOAN BRANCH_NAME AMOUNT
1_11 Roundhill 9000
1_14 Downtown 15000
1_15 Perryridge 15000
1_16 Perryridge 13000
1_17 Downtown 10000
1_23 Redwood 20000
1_93 Mianus 500
DESCRIBE customer_22brs1112;
6. borrower
CUSTOMER_ID LOAN_NO
c_01 1_11
c_01 1_23
c_03 1_93
c_05 1_17
c_03 1_16
c_05 1_14
SELECT branch_name
FROM loan_22brs1112
GROUP BY branch_name
HAVING COUNT(branch_name) > 1;
2. Find branch names in the loan relation without duplicates.
UPDATE account_22brs1112
SET balance = balance - (balance * 0.10);
SELECT customer_name
FROM customer_22brs1112
WHERE customer_city IN ('Pittsfield', 'Stamford');
FROM loan_22brs1112
WHERE branch_name = 'Perryridge' AND amount > 1200;
SELECT loan_no
FROM loan_22brs1112
FROM customer_22brs1112
FROM loan_22brs1112
9. Find the names of the customer whose second letter with ‘u’.
SELECT customer_name
FROM customer_22brs1112
FROM branch_22brs1112
11. Display all the customer whose have account with more than10
yrs (add column account open date, if the column not present).
SELECT customer_name
FROM customer_22brs1112
FROM account_22brs1112
GROUP BY branch_name;
FROM customer_22brs1112
GROUP BY customer_city
FROM account_22brs1112
LIMIT 1;
4. Use replace function and change the word adyar to
Vadapalani.
SELECT REPLACE('adyar', 'adyar', 'Vadapalani') AS replaced_word;
FROM account_22brs1112;
FROM customer_22brs1112;
10. Count the number of days present between today and Sunday.
SELECT DATEDIFF(DATE_ADD(NOW(), INTERVAL (7 - WEEKDAY(NOW())) DAY),
NOW()) AS days_to_sunday;
FROM employee_22brs1112
SELECT *
FROM customer_22brs1112
14. Display all the employees who are born in the month of August.
SELECT *
FROM employee_22brs1112
WHERE MONTH(birthdate) = 8;
15. List all employees who are born between 1st May and 31st Dec of any year.
SELECT *
FROM employee_22brs1112
WHERE MONTH(birthdate) BETWEEN 5 AND 12;
SELECT emp_name
FROM employee_22brs1112
WHERE grade IS NOT NULL;
Group by clause-
FROM employee_22brs1112
GROUP BY department_number;
4. Find the total number of persons working from the employee table and also group by
deptnumberwise.
FROM employee_22brs1112
GROUP BY department_number;
Order By clause-
SELECT customer_name
FROM customer_22brs1112
ORDER BY customer_name;
SELECT customer_name
FROM customer_22brs1112
ORDER BY customer_city;