wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

SKT5 : Bab 2 : SQL

Total questions: 65

Worksheet time: 33mins

Name
Class
Date
1.

Perkaataan apa yang hilang dari garisan di bawah?


SELECT * _______ CUSTOMER;

a)

FROM

b)

WHERE

c)

SELECT

d)

ORDER BY

2.

Apakah maksud * ?

a)

Memilih SEMUA medan dari jadual

b)

Hanya memilih medan pertama dalam jadual

c)

Memilih medan terakhir dalam jadual

d)

Hanya menunjukkan baris pertama dalam jadual

3.

Untuk mencari jumlah nilai dolar jualan, gunakan mana?

a)

SUM

b)

COUNT

c)

MAX

d)

MIN

4.

AVG, COUNT, MAX, MIN dan SUM dikenali sebagai apa?

a)

Fungsi agregat

b)

Penapis wildcard

c)

Subqueries

d)

Medan yang dikira

5.

Apakah susunan klausa yang betul?

a)

SELECT, FROM, ORDER BY, WHERE

b)

SELECT, FROM, WHERE, ORDER BY

c)

SELECT, WHERE, FROM, ORDER BY

d)

WHERE, FROM, SELECT, ORDER BY

6.

Klausa mana yang membolehkan anda menyusun data?

a)

ORDER BY

b)

WHERE

c)

FROM

d)

HAVING

7.

Nama jadual SQL adalah sensitif huruf (case sensitive)

a)

Benar

b)

Palsu

8.

Gunakan klausa yang mana untuk menyaring/ menapis data ?

a)

WHERE

b)

ORDER BY

c)

FROM

d)

HAVING

9.

SELECT MAX(price)

FROM PRODUCT


akan memulangkan berapa banyak baris?

a)

1

b)

0

c)

2

d)

Seperti banyak baris yang terdapat dalam jadual

10.

Kenyataan SQL mana yang digunakan untuk mengemas kini data dalam pangkalan data?

a)

MODIFY

b)

SAVE AS

c)

UPDATE

d)

SAVE

11.

Kenyataan SQL mana yang digunakan untuk memasukkan data baru dalam pangkalan data?

a)

ADD NEW

b)

ADD RECORD

c)

INSERT NEW

d)

INSERT INTO

12.

Dengan SQL, bagaimana anda memilih semua lajur dari jadual yang dinamakan "Persons"?

a)

SELECT [all] FROM Persons

b)

SELECT *.Persons

c)

SELECT * FROM Persons

d)

SELECT Persons

13.

Mana antara kod berikut yang manakah ditulis dengan betul?

a)

SELECT * FROM movies WHERE imdb_rating is 1 AND ORDER by desc;

b)

SELECT * FROM movies WHERE genre = ‘comedy’ AND ORDER BY ASC LIMIT 1:

c)

SELECT * FROM movies WHERE genre = ‘horror’;

d)

SELECT * FROM movies genre is horror, and rating is 2;

14.

Apakah yang dimaksudkan oleh SQL?

a)

Structured Query Language

b)

Structured Question Language

c)

Strong Question Language

d)

Strong Query Language

15.

Kenyataan SQL mana yang digunakan untuk mengeluarkan data dari pangkalan data?

a)

OPEN

b)

GET

c)

EXTRACT

d)

SELECT

16.

Arahan SQL diatas adalah untuk

a)

Mencipta jadual

b)

Mengubah Struktur Jadual

c)

Sisip/Tambah Medan

d)

Pinda/Ubah Medan

e)

Hapus Medan

17.

Arahan SQL diatas adalah untuk

a)

Mencipta jadual

b)

Mengubah Struktur Jadual

c)

Sisip/Tambah Medan

d)

Pinda/Ubah Medan

e)

Hapus Medan

18.

Arahan SQL diatas adalah untuk

a)

Mencipta jadual

b)

Mengubah Struktur Jadual

c)

Sisip/Tambah Medan

d)

Pinda/Ubah Medan

e)

Hapus Medan

19.

Arahan SQL diatas adalah untuk

a)

Mencipta jadual

b)

Mengubah Struktur Jadual

c)

Sisip/Tambah Medan

d)

Pinda/Ubah Medan

e)

Hapus Medan

20.

Arahan SQL diatas adalah untuk

a)

Sisip/tambah data

b)

memadam data

c)

mengemaskini data

d)

membuat data sandaran

21.

Arahan SQL diatas adalah untuk

a)

Sisip/tambah data

b)

memadam data

c)

mengemaskini data

d)

membuat data sandaran

22.

Arahan SQL diatas adalah untuk

a)

Sisip/tambah data

b)

memadam data

c)

mengemaskini data

d)

membuat data sandaran

23.

Arahan SQL diatas adalah untuk

a)

Sisip/tambah data

b)

memadam data

c)

mengemaskini data

d)

Papar data

24.

Arahan SQL diatas adalah untuk

a)

Sisip/tambah data

b)

memadam data

c)

Isih data

d)

Papar data

25.

Arahan SQL diatas adalah untuk

a)

Sisip/tambah data

b)

Susun data

c)

Isih data

d)

Papar data

26.

Arahan SQL diatas adalah untuk

a)

Kira Bilangan

b)

Kira jumlah

c)

Kira purata

d)

Kira Beza

27.

Arahan SQL diatas adalah untuk

a)

Kira Bilangan

b)

Kira jumlah

c)

Kira purata

d)

Kira Beza

28.

Arahan SQL diatas adalah untuk

a)

Kira Bilangan

b)

Kira jumlah

c)

Kira purata

d)

Kira jumlah minima

29.

Arahan SQL diatas adalah untuk

a)

Kira Bilangan

b)

Kira jumlah

c)

Kira purata

d)

Kira jumlah minima

30.

Arahan SQL diatas adalah untuk

a)

Kira Bilangan

b)

Kira jumlah

c)

Kira jumlah maksima

d)

Kira jumlah minima

31.

What does "SQL" stand for?

a)

Structured Question Language

b)

Structured Query Language

c)

Simple Query Language

d)

Simple Question Language

32.

Which statement is used to extract data from a database?

a)

Extract

b)

Get

c)

Open

d)

Select

33.

To remove a record from a table which SQL statement would you use?

a)

Remove

b)

Cancel

c)

Delete

d)

Eradicate

34.

Which statement allows us to add a record to a table?

a)

Add To

b)

Update To

c)

Add Into

d)

Insert Into

35.

Less than or equal to?

a)

>=

b)

=>

c)

=<

d)

<=

36.

Which character returns all the data found in a table?

a)

%

b)

#

c)

*

d)

/

37.

Which word is missing from the following SQL statement?


Select * table_name

a)

With

b)

Where

c)

From

d)

And

38.

How do we select all rows for the "Designer" table?

a)

SELECT * FROM Designer

b)

SELECT [All] FROM Designer

c)

SELECT Designer.*

d)

SELECT FROM Designer

39.

How would we script a SQL query to select "Description" from the Item table?

a)

SELECT Item.Description

b)

EXTRACT Description FROM Item

c)

SELECT Item FROM Description

d)

SELECT Description FROM Item

40.

You are required to update the phone number for only the DesignerID "SMI01" in the "Designer" table. Which of these would successfully do that?

a)

UPDATE Designer SET PhoneNo = '01224123456'

b)

UPDATE Designer (PhoneNo) VALUES ('01224123456')

c)

UPDATE Designer SET PhoneNo = '01224123456' WHERE DesignerID = 'SMI01'

d)

UPDATE PhoneNo = '01224123456' FROM Designer WHERE DesignerID = 'SMI01'

41.

With SQL how can I return all items in the Item table sorted from the lowest priced to the highest priced?

a)

SELECT * FROM Items ORDER BY Price ASCENDING

b)

SELECT * FROM Items ORDER BY Price ASC

c)

SELECT * FROM Items BY Price LOWEST TO HIGHEST

d)

SELECT * FROM Items ORDER BY Price DESC

42.

How would you DELETE records from the Items table with a "Chair" Type?

a)

DELETE 'Chair' FROM Items

b)

DELETE Type FROM Items WHERE Type = 'Chair'

c)

DELETE FROM Items WHERE Type = 'Chair'

d)

DELETE ITEMS WHERE Type = 'Chair'

43.

If you don’t specify ASC or DESC after a SQL ORDER BY clause, the following is used by default

a)

ASC

b)

DESC

c)

There is no default value

d)

None of the mentioned

44.

With SQL, how do you select all the records from a table named “Persons” where the value of the column “FirstName” ends with an “a”?

a)

SELECT * FROM Persons WHERE FirstName=’a’

b)

SELECT * FROM Persons WHERE FirstName LIKE ‘a%’

c)

SELECT * FROM Persons WHERE FirstName LIKE ‘%a’

d)

SELECT * FROM Persons WHERE FirstName=’%a%’

45.

With SQL, how do you select all the records from a table named “Persons” where the value of the column “FirstName” ends with an “a”?

a)

SELECT * FROM Persons WHERE FirstName=’a’

b)

SELECT * FROM Persons WHERE FirstName LIKE ‘a%’

c)

SELECT * FROM Persons WHERE FirstName LIKE ‘%a’

d)

SELECT * FROM Persons WHERE FirstName=’%a%’

46.

What does the ALTER TABLE clause do?

a)

The SQL ALTER TABLE clause modifies a table definition by altering, adding, or deleting table columns and/or constraints

b)

The SQL ALTER TABLE clause is used to insert data into database table

c)

THE SQL ALTER TABLE deletes data from database table

d)

The SQL ALTER TABLE clause is used to delete a database table

47.

The UPDATE SQL clause can _____________

a)

update only one row at a time

b)

update more than one row at a time

c)

delete more than one row at a time

d)

delete only one row at a time

48.

How can you change “Hansen” into “Nilsen” in the “LastName” column in the Persons table?

a)

UPDATE Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’

b)

MODIFY Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’

c)

MODIFY Persons SET LastName=’Hansen’ INTO LastName=’Nilsen’

d)

UPDATE Persons SET LastName=’Nilsen’ WHERE LastName=’Hansen’

49.

Find the names of these cities with temperature and condition whose condition is neither sunny nor cloudy.

a)

SELECT city, temperature, condition FROM weather WHERE condition NOT IN (‘sunny’, ‘cloudy’)

b)

SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN (‘sunny’, ‘cloudy’)

c)

SELECT city, temperature, condition FROM weather WHERE condition IN (‘sunny’, ‘cloudy’)

d)

SELECT city, temperature, condition FROM weather WHERE condition BETWEEN (‘sunny’, ‘cloudy’);

50.

In what order does SQL process the instructions?

a)

FROM - SELECT - WHERE - ORDER BY

b)

WHERE - FROM - SELECT - ORDER BY

c)

SELECT - FROM - WHERE - ORDER BY

d)

SELECT - FROM - ORDER By - WHERE

51.

A primary key can be NULL in the table? TRUE or FALSE

a)

TRUE

b)

FALSE

52.

Which option is not the command of DML ?

a)

insert

b)

update

c)

alter

d)

delete

53.

drop, truncate, create are the commands of DDL?

a)

True

b)

False

54.

_____ is used to filter out the data by applying condition on grouped data.

a)

where

b)

from

c)

having

d)

order by

55.

from the following option select the wrong one.

a)

AND

b)

OR

c)

NOT

d)

greater than equal to

56.

Berikut adalah jadual BARANG dalam pangkalan data Syarikat HRZ Sdn. Bhd. Salin semula pernyataan SQL berikut ke dalam ruangan jawapan dan isi tempat kosong dengan jawapan yang sesuai

DELETE FROM …………X……………….

WHERE ………Y………..= ‘ BOLA HOKI’

a)

X = BARANG

b)

Y = NoBarang

c)

Y= NamaBarang

d)

X = Syarikat HRZ Sdn. Bhd.

57.

Apakah kegunaan fungsi COUNT?

a)

Mengira bilangan medan dalam jadual

b)

Menghitung bilangan lajur dalam jadual.

c)

Menghitung jumlah rekod tertentu daripada jadual.

d)

Mengira jumlah atribut dalam sesuatu jadual.

58.

Jadual 4 menunjukkan pangkalan data di sebuah stor sukan sekolah

Berdasarkan Jadual 4, tulis pernyataan SQL untuk mendapatkan jumlah produk yang dibekalkan oleh Jaya Enterprise

a)

SELECT SUM(Kuantiti )

FROM PRODUK

WHERE Pembekal= ’Jaya Enterprise’;

b)

SELECT*

FROM PRODUK

ORDER BY Item DESC

c)

SELECT SUM(Harga )

FROM PRODUK

WHERE Pembekal= ’Jaya Enterprise’;

59.

Jadual 4 menunjukkan pangkalan data di sebuah stor sukan sekolah.

Berdasarkan Jadual 4, tulis pernyataan SQL untuk

(a) menyenaraikan semua medan daripada jadual PRODUK mengikut urutan menurun dengan berpandukan item barang.

a)

SELECT*

FROM PRODUK

ORDER BY Item DESC

b)

SELECT SUM(Kuantiti )

FROM PRODUK

WHERE Pembekal= ’Jaya Enterprise’;

c)

SELECT*

FROM PRODUK

ORDER BY Item ASC

60.

What does the SQL GROUP BY clause do?

a)

Sorts the result set in ascending order

b)

Combines rows with the same values into summary rows

c)

Filters rows based on a specified condition

d)

Joins two or more tables

61.

Arahan SQL, CREATE, ALTER dan DROP merupakan arahan dalam bahasa ______

a)

Data Definition Language atau Bahasa Takrifan Data (DDL)

b)

Data Manipulation Language atau Bahasa Pengolahan Data (DML)

c)

Data Control Language atau Bahasa Kawalan Data (DCL)

62.

Arahan SQL, SELECT, INSERT, UPDATE dan DELETE merupakan arahan dalam bahasa ______

a)

Data Definition Language atau Bahasa Takrifan Data (DDL)

b)

Data Manipulation Language atau Bahasa Pengolahan Data (DML)

c)

Data Control Language atau Bahasa Kawalan Data (DCL)

63.

Berikut menunjukkan pernyataan SQL untuk mengemaskini stok barangan. Jika stok kurang daripada 20 unit, sebanyak lima unit barang akan ditambah.

1. ____A_____ BARANG

2. ____B_____ Kuantiti = Kuantiti + 5

3. ____C_____ Kuantiti < 20


a)

A. SELECT

B. FROM

C. WHERE

b)

A. ALTER TABLE

B. ADD

C. WHERE

c)

A. UPDATE

B. SET

C. WHERE

d)

A. UPDATE

B. FROM

C. WHERE

64.

What is the purpose of SQL?

a)

To retrieve, delete, and manipulate data in relational databases

b)

To express the logic of how something needs to be achieved

c)

To define and control data access

d)

To create and modify tables in a database

65.

In an SQL query, which built-in function is used to total numeric columns?

a)

AVG

b)

COUNT

c)

MAX

d)

SUM