Question 1 Report
A school science department stores laboratory equipment details in a table called EQUIPMENT.
| EquipID | ItemName | Lab | Quantity | Condition | LastChecked |
|---|---|---|---|---|---|
| EQ01 | Microscope | Lab1 | 12 | Good | 2024-01-15 |
| EQ02 | Bunsen Burner | Lab2 | 8 | Fair | 2024-02-10 |
| EQ03 | Balance Scale | Lab1 | 6 | Good | 2024-01-15 |
| EQ04 | Test Tube Rack | Lab3 | 15 | Good | 2024-03-01 |
| EQ05 | Beaker Set | Lab2 | 10 | Poor | 2023-11-20 |
(a) Write an SQL INSERT statement to add a new record: EquipID 'EQ06', ItemName 'Thermometer', Lab 'Lab1', Quantity 20, Condition 'Good', LastChecked '2024-04-01'. [1]
(a) The SQL INSERT statement adds a new row to a table. [1]
INSERT INTO EQUIPMENT VALUES ('EQ06', 'Thermometer', 'Lab1', 20, 'Good', '2024-04-01')When using INSERT INTO ... VALUES without specifying column names, you must provide values for every column in the same order they appear in the table definition. The values must match the data types of each column: string values like 'EQ06' and 'Thermometer' are enclosed in single quotes, while the integer value 20 (Quantity) has no quotes. The date '2024-04-01' is treated as a string in this format.
An alternative explicit form is:
INSERT INTO EQUIPMENT (EquipID, ItemName, Lab, Quantity, Condition, LastChecked)
VALUES ('EQ06', 'Thermometer', 'Lab1', 20, 'Good', '2024-04-01')This explicit form lists the column names, making the statement more readable and less error-prone, but both forms are accepted.
Everything you need to excel in your exams