wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

SQL-4-select

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

插入資料指令insert,

其格式為

a)

insert into 表名

( ) values ( )

b)

insert into 表名

( ) value ( )

c)

insert 表名 into

( ) values ( )

d)

add into 表名

( ) values ( )

2.

若有資料表user,有2欄位 name跟 password

要放入值 「蔡依林」 跟 「1234」

則指令為?

a)

insert into name='蔡依林', password='1234'

b)

insert into user

name='蔡依林', password='1234'

c)

insert into user (name,password) values ('蔡依林','1234')

d)

insert into user (name,password) values (蔡依林,1234)

3.

若圖,name無法儲存中文。

則何者錯誤?

a)

這是編碼問題

b)

可以在建表時最後面加上charset=utf8mb4

c)

建表指令為

create table book(

isbn varchar(13) not null,

name varchar(100),

primary key(isbn)

) charset=utf8mb4

d)

那是資料錯誤,

不用處理

4.

如上表,isbn是主鍵(有黃色key符號)

如下表,已有2筆資料,

則下列何者錯誤?

a)

還可以新增一筆資料

isbn=123,

name=哈利

b)

還可新增一資料

isbn=125

c)

name的編碼是

utf8mb4_general_ci

d)

空值(Null)若為是,

表示可為空值,

也就是不放資料

5.

擷取select指令的格式為?

a)

select * from 表名 where 條件

b)

select 表名 where 條件

c)

select * from 條件

d)

select * from 表名 for 條件

6.

有使用者的資料表user,生日欄位分成

birthy,表示西元年。birthm表示月,birthd表示日

若想找出所有出生年是2005年的人,則指令為?

a)

select * from user where birthy='2005'

b)

select * from user find birthy='2005'

c)

select * user where birthy='2005'

d)

select * from user where birthy=2005

7.

若有資料表book,有書名欄位name,

想從欄位name中找出所有「哈」字開頭的書,

則指令為?

a)

select * from book where name = '哈%'

b)

select * from book where name like '哈%'

c)

select * from book where name = 哈%

d)

select book where name = '哈%'

8.

多組條件時,要用and/or來合併,且有先後執行順序問題

有姓氏欄位fname及城市欄位city

則下面條件是指?

city='台南' or city='台北' and fname='馬'

a)

台南人 + 台北馬

b)

台南馬+台北馬

c)

台南馬+台北人

d)

台南人+台北人

9.

多組條件時,要用and/or來合併,且有先後執行順序問題

有姓氏欄位fname及城市欄位city

則下面條件是指?

(city='台南' or city='台北') and fname='馬'

a)

台南人 + 台北馬

b)

台南馬+台北馬

c)

台南馬+台北人

d)

台南人+台北人

10.

有姓氏欄位fname及城市欄位city

則下面條件是指?

city='台南' or city='台北' or fname='馬'

a)

台南人+台北馬

b)

台南馬+台北馬

c)

台南人+台北人+所有馬

d)

台南人+台北人