0
0
PostgreSQLquery~10 mins

PostgreSQL vs MySQL key differences - Interactive Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to select all columns from a table named 'employees'.

PostgreSQL
SELECT [1] FROM employees;
Drag options to blanks, or click blank then click option'
Aeverything
B*
CALL
Dcolumns
Attempts:
3 left
💡 Hint
Common Mistakes
Using words like ALL or columns instead of *
Leaving the blank empty
2fill in blank
medium

Complete the code to limit the number of rows returned to 5 in PostgreSQL.

PostgreSQL
SELECT * FROM products [1] 5;
Drag options to blanks, or click blank then click option'
ALIMIT
BFETCH
CTOP
DROWNUM
Attempts:
3 left
💡 Hint
Common Mistakes
Using TOP which is for SQL Server or MySQL
Using ROWNUM which is for Oracle
3fill in blank
hard

Fix the error in the PostgreSQL query to add a new column named 'age' of type integer.

PostgreSQL
ALTER TABLE users [1] COLUMN age INTEGER;
Drag options to blanks, or click blank then click option'
AADD
BCHANGE
CMODIFY
DUPDATE
Attempts:
3 left
💡 Hint
Common Mistakes
Using MODIFY or CHANGE which are MySQL keywords
Using UPDATE which is for changing data, not structure
4fill in blank
hard

Fill both blanks to write a PostgreSQL query that selects all columns from 'orders' and orders results by 'order_date' descending.

PostgreSQL
SELECT [1] FROM orders ORDER BY order_date [2];
Drag options to blanks, or click blank then click option'
A*
BASC
CDESC
DALL
Attempts:
3 left
💡 Hint
Common Mistakes
Using ASC instead of DESC for descending order
Using ALL instead of * for selecting columns
5fill in blank
hard

Fill all three blanks to write a PostgreSQL query that creates a table 'customers' with columns 'id' as serial primary key, 'name' as text, and 'email' as unique text.

PostgreSQL
CREATE TABLE customers (id [1] PRIMARY KEY, name [2], email [3] UNIQUE);
Drag options to blanks, or click blank then click option'
ASERIAL
BTEXT
DVARCHAR
Attempts:
3 left
💡 Hint
Common Mistakes
Using VARCHAR instead of TEXT for name or email
Not using SERIAL for id column