| |
insert
加入一筆新紀錄到資料表中
insert into "tablename"
(first_column,...last_column)
values (first_value,...last_value);
[] = optional
Example:
insert into employee
(first, last, age, address, city, state)
values ('Luke', 'Duke', 45, '2130 Boars Nest', 'Hazard Co', 'Georgia');
* Note: 字串要以單引號住,如:'string'
,數字框住也無妨。
insert into
後面接資料表名稱,再接以括號括住的欄位名,在 values 後括號分別對映各欄位的值。
以上的例子新增了一筆:名(first)
為 'Luke',而住所(state) 為 'Georgia' 的資料了。
Insert 練習_
It is time to insert
data into your new employee table.
有三筆資料在 employees表中:
Jonie Weber, Secretary, 28, 19500.00
Potsy Weber, Programmer, 32, 45300.00
Dirk Smith, Programmer II, 45, 75020.00
再自已建立自已的新增資料。
1
列出全部資料。
2 列出薪資超過 30000 的資料。
3 列出名(first) 、姓(last names),條件為30歲以下者.
4 Select first name, last name, and
salary for anyone with "Programmer" in their title.
5 Select all columns for everyone
whose last name contains "ebe".
6 Select the first name for everyone
whose first name equals "Potsy".
7 Select all columns for everyone
over 80 years old.
8 Select all columns for everyone
whose last name ends in "ith".
Create at least 5
of your own select statements based on specific information that you'd
like to retrieve.
參考解答
SQL Interpreter:
|
|