Back to marketplace

Chapter 19 - Defining and updating tables by using SQL

No description yet. This curated deck is ready for daily study.

Total cards: 24•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (24)

#1
Front (Question)

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

Back (Answer)

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

#2
Front (Question)

What is the purpose of the NOT NULL statement?

Back (Answer)

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

#3
Front (Question)

What is the purpose of the PRIMARY KEY statement?

Back (Answer)

» States the column is the primary key

#4
Front (Question)

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

Back (Answer)

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

#5
Front (Question)

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

Back (Answer)

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

#6
Front (Question)

What is the purpose the BOOLEAN data type?

Back (Answer)

» Make sure the data entered is TRUE or FALSE

#7
Front (Question)

What is the purpose of the INTEGER data type?

Back (Answer)

» Makes sure the data entered is an integer

#8
Front (Question)

What is another way to write the INTEGER data type?

Back (Answer)

» INT

#9
Front (Question)

What is the purpose of the FLOAT data type?

Back (Answer)

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

#10
Front (Question)

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

Back (Answer)

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

#11
Front (Question)

What does the DATE data type do?

Back (Answer)

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

#12
Front (Question)

What is the purpose of the TIME data type?

Back (Answer)

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

#13
Front (Question)

What does the CURRENCY data type do?

Back (Answer)

» Formats numbers in the currency used in your region

#14
Front (Question)

What does the CURRENCY data type do?

Back (Answer)

» Formats numbers in the currency used in your region

#15
Front (Question)

What is the purpose of the ALTER TABLE statement?

Back (Answer)

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

#16
Front (Question)

What is the SQL commands to add a column?

Back (Answer)

ALTER TABLE (tablename) ADD COLUMN DATATYPE

#17
Front (Question)

What is the SQL command do delete a column?

Back (Answer)

ALTER TABLE (tablename) DROP COLUMN (columname)

#18
Front (Question)

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

Back (Answer)

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

#19
Front (Question)

What are the steps to create a linked table

Back (Answer)

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
Front (Question)

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

Back (Answer)

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

#21
Front (Question)

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

Back (Answer)

» 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
Front (Question)

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

Back (Answer)

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

#23
Front (Question)

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

Back (Answer)

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

#24
Front (Question)

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

Back (Answer)

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