42.9 KB · commit 40bb182
| year | 2019 |
|---|---|
| exam | B.Sc. Engineering 2nd Year Even Semester Examination, 2019 |
| course_code | ECE 2215 |
| course_title | Database Systems |
| full_marks | 72 |
| time | 3 Hours |
| layer | exam-style |
← Prev: 2018 | Explanation Layer | Original Question Paper | Next: 2020 →
Topic: T01.2 · File system vs DBMS · Section A
Question. Why DBMS is important? What are its advantages?
Answer.
Importance of DBMS:
A DBMS provides centralized, secure, and coordinated control over an organization's data. It replaces scattered operating system files and ensures that data remains reliable, shared, and recoverable during hardware or software crashes.
Advantages of DBMS over File Processing Systems:
Variant for 2023 Q.1(b) (3 marks): Focus directly on the 5 advantages over file processing systems; omit the general importance statement.
Topic: T02.4 · Weak vs strong entity sets · Section A
Question. What are entity and entity set? How is a weak entity set handled in DBMS? Explain.
Answer.
Handling a Weak Entity Set in DBMS:
ON DELETE CASCADE. If the owner entity tuple is deleted, all dependent weak entity tuples are automatically removed.Topic: T02.5 · Design a full E-R diagram for a scenario · Section A
Question. Suppose you are recruited as a database specialist by the Rajshahi High-Tech authority to help them design a database for train e-ticketing system efficiently. Now think the regular features and draw an E-R diagram accordingly.
Answer.
System Requirements & Entities:
user_id (PK), name, nid, phone.ticket_no (PK), journey_date, seat_no, fare, class.train_no (PK), train_name, total_seats.station_code (PK), station_name, city.Relationships:
Books (1:N): A passenger books one or more tickets. Each ticket is booked by one passenger (descriptive attribute: booking_date).For_Train (N:1): Many tickets belong to a specific train. Each ticket is assigned to exactly one train.Stops_At (M:N): Trains stop at multiple stations, and stations service multiple trains. Descriptive attributes: arrival_time, dep_time.
Figure: Train E-Ticketing System E-R Diagram
Topic: T01.4 · Data abstraction levels, schemas and instances · Section A (Repeated question: Also asked in 2017 | Solved in T01)
Question. What is data abstraction? Describe the different level of data abstraction.
Answer.
Purpose of Data Abstraction:
A database contains complex data structures, storage blocks, and indexing schemes. Most end users and programmers are not trained in low-level storage details. Data abstraction hides this physical complexity. It simplifies user interactions, enforces security, and enables physical data independence.
Levels of Data Abstraction:
type instructor = record
ID : string;
name : string;
dept_name : string;
salary : integer;
end;
Figure: Three levels of data abstraction (Deck 01, Slide 14)
Variant for 2019 Q.2(a) (4 marks): Define data abstraction, describe the three levels, and include the diagram.
Variant for CT-01 Q.01 (5 marks): State the definition, explain the three levels, show the record example, and draw the diagram.
Topic: T04.2 · Write RA queries on a given schema · Section A
Question.
Consider the following relational database.Patient (Patient_ID, Patient_name, Mobile)History (Patient_ID, Symptom, Date)Report (Parient_ID, Corona_center, Test_result)
Now write down the relational algebra (Not SQL) to find out the following queries.
(i) Find the names of those patients who have fever symptom.
(ii) Consider that if any patient has high-fever symptom he/she will be suspected as corona patient. Find out such maximum number of patients in a date.
(iii) Find out the mobile numbers of those patients who have provided samples in Rajshahi corona center and their results have become positive.
(iv) Find out the name of those patients who have high fever symptom but test result have become negative.
(Note: Printed as "Parient_ID" in Report schema in original question paper; refers to "Patient_ID")
Answer.
Assumption: In relation Report, Parient_ID is a typographical misprint for Patient_ID.
(i) Names of patients who have fever symptom:
Join patients with their history records filtered for fever, then project the patient names:
ΠPatient_name(Patient⋈σSymptom="fever"(History))(ii) Maximum number of suspected patients (high-fever symptom) on a date:
Filter records for "high-fever", count patients per date, and take the maximum:
T1←σSymptom="high-fever"(History) Tdaily←Dateγcount(Patient_ID) as patient_count(T1) γmax(patient_count)(Tdaily)(iii) Mobile numbers of patients tested in Rajshahi corona center with positive results:
Filter reports for Rajshahi center and positive results, join with Patient, and project mobile numbers:
ΠMobile(Patient⋈σCorona_center="Rajshahi"∧Test_result="positive"(Report))(iv) Names of patients who have high fever symptom but negative test result:
Find patients who have high fever and whose test result is negative:
Thigh←ΠPatient_ID(σSymptom="high-fever"(History)) Tneg←ΠPatient_ID(σTest_result="negative"(Report)) ΠPatient_name(Patient⋈(Thigh∩Tneg))Short version for 2024 Q.5(a) (Sec B, 4 marks, CO2):
Answer parts (i) and (ii) only. Part (i) matches part (i) above. Part (ii) targets Rangpur instead of Rajshahi:
Topic: T08.6 · Define normalization (and its importance) & 1NF / 2NF / 3NF · Section A
Question. What is normalization? Discuss 1NF and 2NF.
Answer.
Normalization is the process of decomposing a relation schema into smaller schemas to minimize data redundancy and prevent insertion, deletion, and update anomalies.
Rules:
Example:
Violating 1NF:
| Student_ID | Name | Phone |
|---|---|---|
| S01 | Fahim | 01711, 01822 |
| S02 | Noor | 01933 |
Converted to 1NF (atomic rows):
| Student_ID | Name | Phone |
|---|---|---|
| S01 | Fahim | 01711 |
| S01 | Fahim | 01822 |
| S02 | Noor | 01933 |
PK: (Student_ID, Phone)
Rules:
Example:
Consider relation ENROLL(StudentID, CourseID, StudentName, Grade):
(StudentID, CourseID)(StudentID, CourseID) -> Grade (Full dependency)StudentID -> StudentName (Partial dependency on proper subset StudentID)Converted to 2NF (decompose to remove partial dependency):
STUDENT(StudentID, StudentName) with PK StudentIDENROLLMENT(StudentID, CourseID, Grade) with PK (StudentID, CourseID)Short version for 2018 Q.4(c) (4 marks): State the rules for 1NF (atomicity, no multi-valued attributes) with the phone number example. State the rules for 2NF (in 1NF, no partial dependencies) with the student course example.
Topic: T09.2 · Consistency property alone, with example · Section A
Question. Explain the consistency property of a database system with a proper example.
Answer.
Definition:
The consistency property requires that executing a transaction in isolation preserves the consistency of the database. If the database starts in a valid state that satisfies all integrity rules, it must end in a valid state after the transaction completes.
Categories of Consistency Constraints:
CHECK constraints (such as balance >= 0).Example (Bank Transfer):
Let account A have $1000 and account B have $2000. The consistency invariant requires total funds to remain constant:
Transaction T1 transfers $50 from A to B:
Topic: T06.1 · Types of joins · Section A
Question. What is joining? Discuss each type of joining between two data tables with example.
Answer.
Definition of Joining:
A join operation takes two relations and combines them into one relation based on a matching condition. It acts as a Cartesian product followed by a selection predicate and projection.
Figure: Join types and join conditions (Deck 04, Slide 4)
Example Base Tables:
Table course:
| course_id | title | dept_name | credits |
|---|---|---|---|
| BIO-301 | Genetics | Biology | 4 |
| CS-190 | Game Design | Comp. Sci. | 4 |
| CS-315 | Robotics | Comp. Sci. | 3 |
Table prereq:
| course_id | prereq_id |
|---|---|
| BIO-301 | BIO-101 |
| CS-190 | CS-101 |
| CS-347 | CS-101 |
Retains only tuples that satisfy the join condition in both tables. Unmatched rows are dropped.
SELECT course.course_id, title, dept_name, prereq_id
FROM course
INNER JOIN prereq ON course.course_id = prereq.course_id;
Relational algebra:
course⋈prereqResult:
| course_id | title | dept_name | prereq_id |
|---|---|---|---|
| BIO-301 | Genetics | Biology | BIO-101 |
| CS-190 | Game Design | Comp. Sci. | CS-101 |
Preserves every row from the left table (course). Fills right-table attributes with NULL when no match exists.
SELECT course.course_id, title, dept_name, prereq_id
FROM course
LEFT JOIN prereq ON course.course_id = prereq.course_id;
Relational algebra:
course⟕prereqResult:
| course_id | title | dept_name | prereq_id |
|---|---|---|---|
| BIO-301 | Genetics | Biology | BIO-101 |
| CS-190 | Game Design | Comp. Sci. | CS-101 |
| CS-315 | Robotics | Comp. Sci. | NULL |
Preserves every row from the right table (prereq). Fills left-table attributes with NULL when no match exists.
SELECT prereq.course_id, title, dept_name, prereq_id
FROM course
RIGHT JOIN prereq ON course.course_id = prereq.course_id;
Relational algebra:
course⟖prereqResult:
| course_id | title | dept_name | prereq_id |
|---|---|---|---|
| BIO-301 | Genetics | Biology | BIO-101 |
| CS-190 | Game Design | Comp. Sci. | CS-101 |
| CS-347 | NULL | NULL | CS-101 |
Retains all rows from both tables. It pairs matching rows and fills missing values with NULL. MySQL emulates it using UNION.
SELECT course.course_id, title, dept_name, prereq_id
FROM course
LEFT JOIN prereq ON course.course_id = prereq.course_id
UNION
SELECT prereq.course_id, title, dept_name, prereq_id
FROM course
RIGHT JOIN prereq ON course.course_id = prereq.course_id;
Relational algebra:
course⟗prereqResult:
| course_id | title | dept_name | prereq_id |
|---|---|---|---|
| BIO-301 | Genetics | Biology | BIO-101 |
| CS-190 | Game Design | Comp. Sci. | CS-101 |
| CS-315 | Robotics | Comp. Sci. | NULL |
| CS-347 | NULL | NULL | CS-101 |
Combines each row of the first table with every row of the second table without any condition.
SELECT *
FROM course
CROSS JOIN prereq;
Relational algebra:
course×prereqIt returns 3×3=9 rows.
Variant for 2023 Q.5(c) (4 marks): The same definition and four outer and inner join examples answer the question.
Topic: [[Topicwise_answers_exam_style/T10_Serializability.md#T10.4 · Build serializable/non-serializable schedules (T1,T2 with "if A = 0 then B := B+1")|T10.4 · Build serializable/non-serializable schedules (T1,T2 with "if A = 0 then B := B+1")]] · Section A
Question.
What is concurrency control? Consider the following two transactions.
T1:read (P);read (Q);if P=10 then Q:=Q-5;write (Q);
T2:read (Q);read (P);if Q=10 then P:=P+5;write (P);
Let the consistency requirement be P=5 or Q=5 with P=Q=5 the initial values.
(i) Show a concurrent execution of T1 and T2 that produces a serializable schedule.
(ii) Is there a concurrent execution of T1 and T2 that produces a serializable schedule?
(Note: In the printed question paper, sub-question (ii) is printed identically to (i) as "Is there a concurrent execution of T1 and T2 that produces a serializable schedule?")
Answer.
Assumption: Sub-question (ii) repeats (i) due to a printing error, and the IF conditions test P = 10 / Q = 10 while initial values are P = Q = 5; we answer as printed, and also show the intended reading modeled on the Silberschatz consistency exercise.
Concurrency control is the DBMS mechanism that coordinates the simultaneous execution of transactions. It prevents anomalies like lost updates, dirty reads, and unrepeatable reads. It ensures transactions maintain the Isolation and Consistency ACID properties while maximizing transaction throughput.
Initial values: P=5,Q=5. Consistency condition: P=5∨Q=5.
Because initial values are 5:
P = 10 evaluates to false. Q is not changed, so T1 writes Q=5.Q = 10 evaluates to false. P is not changed, so T2 writes P=5.The values of P and Q remain 5 in all executions. Consistency (P=5∨Q=5) is always maintained.
To make a concurrent execution serializable, one transaction must complete its accesses on the shared item before the other transaction accesses it:
| Step | T1 | T2 |
|---|---|---|
| 1 | read(P); | |
| 2 | read(Q); | |
| 3 | if P=10 then Q:=Q-5;write(Q); | |
| 4 | read(Q); | |
| 5 | read(P); | |
| 6 | if Q=10 then P:=P+5;write(P); |
If sub-question (ii) intended to ask whether an interleaved concurrent execution can be non-serializable (or if condition matches initial state as in the textbook):
Consider an interleaved schedule where both read before writing:
| Step | T1 | T2 |
|---|---|---|
| 1 | read(P); | |
| 2 | read(Q); | |
| 3 | read(Q); | |
| 4 | read(P); | |
| 5 | write(Q); | |
| 6 | write(P); |

Conclusion: Genuinely interleaved executions where both transactions read before either writes always create a cycle T1⟷T2. Therefore, interleaved concurrent executions are non-serializable.
Topic: T12.1 · Failure classification, precautions, recovery methods · Section A
Question. How many ways a DBMS could be failed? What precautions should be taken considering the failure of DBMS and point out the recovery methods.
Answer.
A DBMS can fail in three primary ways:
Short version for 2024 Q.3(b) (CO1, 4 marks): Provide the same three sections in concise bullet points to fit the 4-mark time limit.
Topic: T05.1 · What SQL is; SQL short note · Section B
Question. Write a short note on SQL.
Answer.
SQL (Structured Query Language) is the standard declarative computer language used to define, query, and manipulate data in relational database management systems (RDBMS). It was originally developed at IBM in the 1970s for System R.
Key parts of SQL include:
CREATE, ALTER, DROP).SELECT, INSERT, UPDATE, DELETE).GRANT, REVOKE) and transaction boundaries (COMMIT, ROLLBACK).SQL is declarative. The user specifies what result is wanted rather than how to calculate it.
Topic: T05.7 · Multi-table business-schema query sets (MySQL): Covid, Company, Insurance, E-commerce · Section B
Question.
Consider the following relational database.Patient (Patient_ID, Patient_name, Mobile)History (Patient_ID, Symptom, Date)Report (Parient_ID, Corona_center, Test_result)
Now write down the SQL (Not Algebra) to find out the following queries.
(i) Find the names of those patients who have-fever symptom.
(ii) Consider that if any patient has high fever symptom he/she will be suspected as corona patient. Find out such maximum number of patients in a date.
(iii) Find out the mobile numbers of those patients who have provided samples in Rajshahi corona center and their results have become positive.
(iv) Find out the name of those patients who have high fever symptom but test result have become negative.
(Note: In the physical question paper, SECTION-B heading and Q.5(a)–(b) appear at the bottom of Page 1; Q.5(c) continues at the top of Page 2)
(Note: Printed as "Parient_ID" in Report schema in original question paper; refers to "Patient_ID")
Answer.
Assumption: "Parient_ID" in the Report table is a typographical misprint for Patient_ID and joins with Patient.Patient_ID.
(i) Names of patients who have fever symptom:
SELECT DISTINCT p.Patient_name
FROM Patient p
JOIN History h ON p.Patient_ID = h.Patient_ID
WHERE h.Symptom LIKE '%fever%';
(ii) Maximum number of high-fever patients recorded on a single date:
SELECT MAX(daily_count) AS max_patients
FROM (
SELECT Date, COUNT(DISTINCT Patient_ID) AS daily_count
FROM History
WHERE Symptom = 'high fever'
GROUP BY Date
) AS daily_summary;
(Alternative returning the specific date with the peak count: SELECT Date, COUNT(DISTINCT Patient_ID) AS patient_count FROM History WHERE Symptom = 'high fever' GROUP BY Date ORDER BY patient_count DESC LIMIT 1;)
(iii) Mobile numbers of patients tested in Rajshahi corona center with positive result:
SELECT DISTINCT p.Mobile
FROM Patient p
JOIN Report r ON p.Patient_ID = r.Parient_ID
WHERE r.Corona_center = 'Rajshahi'
AND r.Test_result = 'positive';
(iv) Names of patients with high fever symptom whose test result is negative:
SELECT DISTINCT p.Patient_name
FROM Patient p
JOIN History h ON p.Patient_ID = h.Patient_ID
JOIN Report r ON p.Patient_ID = r.Parient_ID
WHERE h.Symptom = 'high fever'
AND r.Test_result = 'negative';
Topic: T05.2 · DDL + DML warm-up: CREATE, INSERT, ALTER ... ADD, UPDATE, DELETE, rename, filter · Section B
Question.
Write down the SQL queries to create the following tables.Answer.
Assumption: "Parient_ID" in the Report table is a typographical misprint for Patient_ID and serves as a foreign key referencing the Patient table.
CREATE TABLE Patient (
Patient_ID INT PRIMARY KEY,
Patient_name VARCHAR(50),
Mobile VARCHAR(15)
);
CREATE TABLE History (
Patient_ID INT,
Symptom VARCHAR(50),
Date DATE,
PRIMARY KEY (Patient_ID, Symptom, Date),
FOREIGN KEY (Patient_ID) REFERENCES Patient(Patient_ID)
);
CREATE TABLE Report (
Patient_ID INT PRIMARY KEY,
Corona_center VARCHAR(50),
Test_result VARCHAR(20),
FOREIGN KEY (Patient_ID) REFERENCES Patient(Patient_ID)
);
Topic: T08.1 · Why normalize: redundancy and insert/update/delete anomalies · Section B
Question.
Consider the following data tables.
Student
| Roll | Name | Dept | Sub Code | Sub Grade | Reg Sub Code |
|---|---|---|---|---|---|
| 1710001 | Mr. A | ECE | ECE-2103 | A+ | ECE-2103 ECE-2107 |
| 1710002 | Mr. B | ECE | ECE-2107 | A | ECE-2103 ECE-2107 |
| 1710003 | Mr. C | ECE | ECE-2103 | A- | ECE-2103 |
| 1710004 | Mr. D | ECE | ECE-2107 | A+ | ECE-2107 |
| 1710001 | Mr. A | ECE | ECE-2107 | A- | ECE-2103 ECE-2107 |
| 1710002 | Mr. B | ECE | ECE-2103 | A+ | ECE-2103 ECE-2107 |
Answer.
The table is highly space-inefficient for three reasons:
Name ("Mr. A", "Mr. B") and Dept ("ECE") are repeated across multiple rows for the same Roll.Reg Sub Code contains multi-valued lists (e.g., ECE-2103, ECE-2107). Storing this composite list in every row for a student wastes substantial storage.Updating any student-level or course-level attribute causes an update anomaly:
1710001 must be updated.Reg Sub Code must be modified across every row for that student.1710001 could end up with different department names or conflicting registered course lists in different rows.If asked to delete 'ECE-2107' from the registered course list while preserving all other data:
Reg Sub Code across all their records and strip 'ECE-2107'. This is slow and error-prone.Reg Sub Code to NULL leaves an incomplete record.Topic: T03.2 · Keys: super / candidate / primary / alternate / composite / foreign · Section B
Question. Discuss the different keys in DBMS. Write down the importance and use of foreign key with example.
Answer.
1. Different Keys in DBMS:
2. Importance and Use of Foreign Key:
CASCADE, SET NULL, RESTRICT). When parent records change, child records update or delete automatically.Example:
Consider two relations:
Here, dept_name in Student is a foreign key referencing dept_name in Department.
'ECE', 'ECE' must exist in Department.dept_name = 'Civil', and 'Civil' is not in Department, the DBMS rejects the insert. This protects database integrity.Topic: T05.5 · Aggregation queries: GROUP BY + HAVING, CGPA, extremes without LIMIT · Section B
Question.
Considering the following data tables (Student, GPA, Credits) answer (i), (ii), (iii), & (iv).
Student
| St_ID | St Name |
|---|---|
| 2010001 | Abdullah |
| 2010002 | Ahmad |
| 2010003 | Mohammad |
| 2010004 | Muaz |
| 2010005 | Minhaz |
| St_ID | Sub_Code | gpa |
|---|---|---|
| 2010001 | ECE-1103 | 3.00 |
| 2010002 | ECE-1107 | 3.25 |
| 2010004 | ECE-1103 | 4.00 |
| 2010005 | ECE-1103 | 4.00 |
| 2010003 | ECE-1107 | 3.75 |
| Sub_Code | Credit |
|---|---|
| ECE-1103 | 3.00 |
| ECE-1107 | 3.00 |
Answer.
(i) List of students who got the lowest GPA:
SELECT s.St_ID, s.`St Name`, g.Sub_Code, g.gpa
FROM Student s
JOIN GPA g ON s.St_ID = g.St_ID
WHERE g.gpa = (
SELECT MIN(gpa)
FROM GPA
);
(ii) Registered subjects of students whose name starts with "A":
SELECT DISTINCT s.St_ID, s.`St Name`, g.Sub_Code
FROM Student s
JOIN GPA g ON s.St_ID = g.St_ID
WHERE s.`St Name` LIKE 'A%';
(iii) Calculate CGPA of each student:
SELECT s.St_ID, s.`St Name`,
SUM(g.gpa * c.Credit) / SUM(c.Credit) AS cgpa
FROM Student s
JOIN GPA g ON s.St_ID = g.St_ID
JOIN Credit c ON g.Sub_Code = c.Sub_Code
GROUP BY s.St_ID, s.`St Name`;
(iv) Each subject code and corresponding highest GPA:
SELECT Sub_Code,
MAX(gpa) AS highest_gpa
FROM GPA
GROUP BY Sub_Code;
Topic: T05.4 · Aggregate functions (theory) · Section B
Question. Discuss about four aggregate functions.
Answer.
An aggregate function takes a collection (multiset) of values from a specified attribute and computes a single summarizing scalar value. SQL ignores null values during aggregation (except for COUNT(*)).
Four standard aggregate functions:
COUNT():COUNT(*) counts all rows in the relation, including duplicates and nulls.COUNT(A) counts non-null values of attribute A.SELECT COUNT(*) FROM instructor;
SUM():SELECT SUM(salary) FROM instructor;
AVG():SELECT AVG(salary) FROM instructor WHERE dept_name = 'ECE';
MIN() and MAX():SELECT MIN(salary) AS min_sal, MAX(salary) AS max_sal FROM instructor;
Topic: T05.6 · Subqueries theory ("two examples"): IN, SOME/ALL, EXISTS, scalar, correlated, WITH · Section B (Repeated question: Also asked in 2024 | Solved in T05)
Question. Write down two examples of using sub-queries.
Answer.
Explanation: A subquery (or nested query) is a SELECT statement embedded inside another SQL statement (the outer query). It can appear in the WHERE clause to filter tuples, in the FROM clause as a temporary derived relation, or in the SELECT clause as a scalar expression. Subqueries allow multi-step data retrieval in a single query.
Example 1: Set Membership Subquery (IN)
Find all courses offered in Fall 2017 that were also offered in Spring 2018:
SELECT DISTINCT course_id
FROM section
WHERE semester = 'Fall' AND year = 2017
AND course_id IN (
SELECT course_id
FROM section
WHERE semester = 'Spring' AND year = 2018
);
The inner subquery generates the set of courses running in Spring 2018. The outer query checks whether Fall 2017 courses belong to that generated set.
Example 2: Scalar Comparison Subquery (AVG)
Find instructors whose salary is higher than the average salary of all instructors:
SELECT name, salary
FROM instructor
WHERE salary > (
SELECT AVG(salary)
FROM instructor
);
The inner query computes a single numeric value (the overall average salary). The outer query evaluates the > predicate against this scalar value for each instructor.
Variant for 2019 Q.8(b) (4 marks): Presenting the two SQL examples with their purpose answers the question.
Topic: T05.8 · Short notes: ON DELETE CASCADE, GROUP BY, ORDER BY, AS · Section B (Repeated question: Also asked in 2024 | Solved in T05)
Question.
Write short note on the following statements.
(i) ON CASCADE DELETE.
(ii) Group By.
Answer.
i) ON DELETE CASCADE (printed as "ON CASCADE DELETE"):
A foreign key referential integrity action. When a tuple in the parent table is deleted, the DBMS automatically deletes all corresponding referencing tuples in the child table. This maintains referential integrity and prevents orphaned records.
CREATE TABLE section (
course_id VARCHAR(8),
sec_id VARCHAR(8),
semester VARCHAR(6),
year NUMERIC(4, 0),
PRIMARY KEY (course_id, sec_id, semester, year),
FOREIGN KEY (course_id) REFERENCES course(course_id)
ON DELETE CASCADE
);
ii) GROUP BY:
An SQL clause used to partition table rows into distinct groups having identical values in specified columns. Aggregate functions (COUNT, SUM, AVG, MIN, MAX) then compute summary statistics for each individual group.
SELECT dept_name, AVG(salary) AS avg_sal
FROM instructor
GROUP BY dept_name;
iii) ORDER BY:
An SQL clause that sorts query result rows in ascending (ASC, default) or descending (DESC) order based on one or more attributes. Multiple sort keys break ties sequentially.
SELECT name, salary
FROM instructor
ORDER BY salary DESC, name ASC;
iv) AS:
An SQL keyword used to define an alias (an alternative temporary name). It can rename an attribute or computed expression in the SELECT clause for readability, or rename a table in the FROM clause to shorten table references and enable self-joins.
SELECT salary * 1.15 AS revised_salary
FROM employee AS e;
Short version for 2019 Q.8(c) (4 marks): Provide parts (i) and (ii).
Short version for 2023 Q.6(c) (2 marks): Provide part (i) with definition, syntax, and effect.
← Prev: 2018 | Explanation Layer | Original Question Paper | Next: 2020 →