KEMBAR78
DB Marking Scheme PDF | PDF | Sql | Information Technology
0% found this document useful (0 votes)
107 views1 page

DB Marking Scheme PDF

The document contains 6 multiple choice questions from a database technologies exam for a Higher Diploma Two program, testing knowledge of SQL statements for performing operations like adding a column, selecting data, deleting rows, joining tables, and grouping and aggregating data. Students are asked to write SQL statements to add a nationality column, select female sellers ordered by name, delete rows from a table, count products by unit of measurement, produce a report joining two tables, and sketch the output of a query.

Uploaded by

mike akim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views1 page

DB Marking Scheme PDF

The document contains 6 multiple choice questions from a database technologies exam for a Higher Diploma Two program, testing knowledge of SQL statements for performing operations like adding a column, selecting data, deleting rows, joining tables, and grouping and aggregating data. Students are asked to write SQL statements to add a nationality column, select female sellers ordered by name, delete rows from a table, count products by unit of measurement, produce a report joining two tables, and sketch the output of a query.

Uploaded by

mike akim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

NATIONAL INSTITUTE OF TRANSPORT

DEPARTMENT OF COMPUTING AND COMMUNICATION TECHNOLOGY


HIGHER DIPLOMA TWO IN INFORMATION TECHNOLOGY (HDIT-2)
HIGHER DIPLOMA TWO IN COMPUTER SCIENCE (HDCS-2)
TEST ONE 10 MARKS TIME: 1.0 HRS

ITU 07301 DATABASE TECHNOLOGIES Tuesday 13th December 2022


ITU 07307 DATABASE SYSTEMS

Answer all questions.

1). Write SQL statement that will add a column named nationality between the sellerName and the DoB columns of the seller table given
that the default nationality is Tanzanian. (1.5 Marks)
ALTER TABLE seller ADD nationality VARCHAR(200) NOT NULL DEFAULT 'Tanzanian' AFTER sellerName;
2). Write SQL statement that list all female sellers in descending order of their names. (1.5 Marks)
SELECT * FROM seller WHERE gender="Female" ORDER BY sellerName DESC;
OR
SELECT * FROM seller WHERE gender !="Male" ORDER BY sellerName DESC;
3). Write SQL DML statement that will remove all data from the sellerMobile table. (1.0 Mark)
DELETE FROM sellerMobile;

4). Write SQL statement to answer the question how many products are measured in either liters (lt) or milliliters (ml) (2.0 Marks)
SELECT COUNT(*) From product WHERE description LIKE "%lt" OR description LIKE "%ml";
5). Using INNER JOIN, whrite SQL statement that will produce a report showing sellerID, sellerName, gender and sellerMobile.
(2.0 Marks)
SELECT S.SellerID, S.sellerName, S.gender, SM.mobileNumber FROM seller S INNER JOIN sellerMobile SM USING(sellerID);
OR
SELECT S.SellerID, S.sellerName, S.gender, SM.mobileNumber FROM seller S INNER JOIN sellerMobile SM ON S.sellerID =
SM.sellerID;

6). Sketch the output of the following query (2.0 Marks)


SELECT sellerID `Namba ya Muuzaji`, sellerName `Jina la Muuzaji`, DoB `Tarehe ya Kuzaliwa`, gender Jinsi FROM seller WHERE sellerID
IN (SELECT sellerID FROM sellerMobile GROUP BY sellerID HAVING COUNT(sellerID)>1) ORDER BY sellerName DESC, sellerID ASC;

You might also like