返回卡包市场

Chapter 19 - Defining and updating tables by using SQL

暂无描述。系统推荐的高质量记忆内容,适合每天坚持背诵学习。

卡片总数: 24内容版本: v4公开卡包更新时间: 8/1/2026

卡片预览 (24 张)

#1
正面 (问题)

What are the commands to create a new table in the SQL?

背面 (解答)

» CREATE TABLE (tablename) { Column1 Data type,etc Column2 Data type,etc Column3 Data type, etc }

#2
正面 (问题)

What is the purpose of the NOT NULL statement?

背面 (解答)

» If you put it in when you create a new table, it is a compulsory field

#3
正面 (问题)

What is the purpose of the PRIMARY KEY statement?

背面 (解答)

» States the column is the primary key

#4
正面 (问题)

What is the purpose the CHAR(n) data type?

背面 (解答)

» Makes sure the data entered character’s are a fixed length of, n

#5
正面 (问题)

What is the purpose of the VARCHAR(n) data type?

背面 (解答)

» Makes sure the data entered has a character string variable of max length, n

#6
正面 (问题)

What is the purpose the BOOLEAN data type?

背面 (解答)

» Make sure the data entered is TRUE or FALSE

#7
正面 (问题)

What is the purpose of the INTEGER data type?

背面 (解答)

» Makes sure the data entered is an integer

#8
正面 (问题)

What is another way to write the INTEGER data type?

背面 (解答)

» INT

#9
正面 (问题)

What is the purpose of the FLOAT data type?

背面 (解答)

» Make sure it is a number with a floating decimal point

#10
正面 (问题)

What does it mean by the FLOAT(X,Y) command?

背面 (解答)

» X - Maximum number of digits is X » Y - Maximum number after decimal point is Y

#11
正面 (问题)

What does the DATE data type do?

背面 (解答)

» Stores the data entered as Day,Month,Year values

#12
正面 (问题)

What is the purpose of the TIME data type?

背面 (解答)

» Stores the data entered as Hour,Minute,Second values

#13
正面 (问题)

What does the CURRENCY data type do?

背面 (解答)

» Formats numbers in the currency used in your region

#14
正面 (问题)

What does the CURRENCY data type do?

背面 (解答)

» Formats numbers in the currency used in your region

#15
正面 (问题)

What is the purpose of the ALTER TABLE statement?

背面 (解答)

» To add, delete or modify columns in an exisiting table

#16
正面 (问题)

What is the SQL commands to add a column?

背面 (解答)

ALTER TABLE (tablename) ADD COLUMN DATATYPE

#17
正面 (问题)

What is the SQL command do delete a column?

背面 (解答)

ALTER TABLE (tablename) DROP COLUMN (columname)

#18
正面 (问题)

What is the SQL command to change the data type of a column?

背面 (解答)

ALTER TABLE (tablename) MODIFY COLUMN (columname) …. DATATYPE you want to modify

#19
正面 (问题)

What are the steps to create a linked table

背面 (解答)

CREATE TABLE (tablename) { Column1 Column2 … DATATYPE FOREIGN KEY COLUMN REFERENCE X FOREIGN KEY COLUMN REFERENCE Y PRIMARY KEY (FOREIGN KEY, FOREIGN KEY) } » Note X and Y are where the foreign key originally came from, e.g for a foreign key called COURSEID which came from Course, X would look like Course(COURESEID)

#20
正面 (问题)

What is the SQL statement to insert a new record in a database table?

背面 (解答)

INSERT INTO tablename(column1,column2) VALUES (value1,value2…) ……….

#21
正面 (问题)

What is some tips to remember about the stuff in brackets in VALUES (value1…)?

背面 (解答)

» Everything should be seperated by a comma » Speech marks for all the strings inserted » Apart from CURRENCY and Date » Data has the syntax #day/month/year# » Currency does not need anything else

#22
正面 (问题)

What would be a more efficient way of inserting data, when all the fields are being added in the correct order?

背面 (解答)

» You would not need fields names in the INSERT statement » INSERT INTO tablename - would be enough

#23
正面 (问题)

What is the SQL statement to update a record in a database table?

背面 (解答)

UPDATE tablename SET column1 = value1, column 2 =value2….. WHERE ColumnX = value » Example: UPDATE EMPLOYEE SET SALARY = SALARY*1.1 WHERE DEPARTMENT = “TECHNICAL”

#24
正面 (问题)

What is the SQL statement to delete a record from a database table?

背面 (解答)

DELETE FROM tablename WHERE columnx = value » Example: DELETE FROM EMPLOYEE WHERE EmpID = “1122”