Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a new table named 'employees'.
SQL
CREATE [1] employees (id INT, name VARCHAR(100));
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using CREATE DATABASE instead of CREATE TABLE.
Using CREATE VIEW when a table is needed.
✗ Incorrect
The CREATE TABLE statement is used to create a new table in the database.
2fill in blank
mediumComplete the code to insert a new row into the 'employees' table.
SQL
INSERT INTO employees [1] (1, 'Alice');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using SET instead of VALUES in INSERT statements.
Using SELECT incorrectly in this context.
✗ Incorrect
The INSERT INTO ... VALUES statement adds new rows to a table.
3fill in blank
hardFix the error in the query to select all columns from 'employees'.
SQL
SELECT [1] FROM employees; Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using ALL or EVERY which are not valid in this context.
Trying to write ALL_COLUMNS which is not a SQL keyword.
✗ Incorrect
The asterisk (*) means select all columns from the table.
4fill in blank
hardFill both blanks to grant SELECT permission on 'employees' to user 'john'.
SQL
GRANT [1] ON employees TO [2];
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Granting INSERT instead of SELECT.
Using the wrong username.
✗ Incorrect
The GRANT SELECT statement gives read permission to a user.
5fill in blank
hardFill all three blanks to update the name of employee with id 1 to 'Bob'.
SQL
UPDATE employees SET [1] = [2] WHERE [3] = 1;
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using salary instead of name.
Forgetting quotes around 'Bob'.
Using wrong condition column.
✗ Incorrect
The UPDATE statement changes data. We set the name to 'Bob' where id equals 1.