CS405 Midterm Current Solved Subjective by Maha
- Type
- Midterm past paper
- Course
- CS405 Database Programming using Oracle 11g
- Size
- PDF 4.3 MB
- Updated
- 23 Oct 2026
You get 3 free files a day on the website. Add the Chrome extensionSign in with the extension for 30 a day.
Preview text
Text from pages 1, 2, 3 of 15. Download the file for all 15 pages.
✅ Example:
DECLARE
👉 Output (if salary = 5000):
High Salary
1. Syntax of IF-THEN-ELSE Statement
The IF-THEN-ELSE statement in PL/SQL is used for conditional execution.
✅ Syntax:
IF condition THEN -- Execute when condition is TRUE ELSE -- Execute when condition is FALSE END IF;
salary NUMBER := 5000; BEGIN IF salary > 4000 THEN DBMS_OUTPUT.PUT_LINE(' High Salary'); ELSE DBMS_OUTPUT.PUT_LINE(' Low Salary'); END IF; END;
Explanation:
2. Syntax of HAVING Clause
The HAVING clause is used in SQL to filter groups of records created by the GROUP BY clause.
✅ Syntax:
SELECT column_name, COUNT(*)
FROM table_name
GROUP BY column_name
HAVING condition;
✅ Example:
SELECT deptno, AVG(salary) FROM employees GROUP BY deptno HAVING AVG(salary) > 50000;
� GROUP BY deptno groups records based on department number. � HAVING AVG(salary) > 50000 filters only those departments where average salary is greater than 50,000.
WHERE is used to filter individual rows. HAVING is used to filter groups after aggregation.
3. Difference between Primary Key and Unique Key
✅ Example Table:
CREATE TABLE employees (
👉 Output: Returns the total number of employees.
✅ Example of GROUP BY Clause
✅ Example of GROUP FUNCTION (No GROUP BY)
SELECT COUNT(*) FROM employees;
1. Difference Between GROUP FUNCTION and GROUP BY Clause
emp_id NUMBER PRIMARY KEY, Unique) email VARCHAR2(100) UNIQUE Allowed, Unique) --Primary Key (No NULL,
--Unique Key (NULL
Related CS405 files
All CS405 files →Get more out of VUBuddy, for free
- Unlimited downloads
- The explanation behind every MCQ answer
- Study offline on slow data
- 30 downloads a day instead of 3
- Sign in and buy Pro Semester here
One Pro Semester membership works in both the extension and the app.