0
0
PostgreSQLquery~10 mins

What is PostgreSQL - Interactive Quiz & 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 users.

PostgreSQL
SELECT [1] FROM users;
Drag options to blanks, or click blank then click option'
A*
BALL
CCOLUMNS
DEVERYTHING
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ALL' instead of '*' causes syntax error.
Writing 'COLUMNS' or 'EVERYTHING' is not valid SQL.
2fill in blank
medium

Complete the code to create a new table named products with an id column.

PostgreSQL
CREATE TABLE [1] (id SERIAL PRIMARY KEY);
Drag options to blanks, or click blank then click option'
Aorders
Bproducts
Citems
Dcustomers
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong table names like 'items' or 'orders'.
Misspelling the table name.
3fill in blank
hard

Fix the error in the query to get the count of rows in the users table.

PostgreSQL
SELECT COUNT([1]) FROM users;
Drag options to blanks, or click blank then click option'
Auser_id
Bid
Call
D*
Attempts:
3 left
💡 Hint
Common Mistakes
Using a column name that may have nulls, causing wrong counts.
Using 'all' which is not valid syntax.
4fill in blank
hard

Fill all three blanks to select name and age from people where age is greater than 30.

PostgreSQL
SELECT [1], [2] FROM people WHERE age [3] 30;
Drag options to blanks, or click blank then click option'
Aname
Bage
C>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' instead of '>' in the WHERE clause.
Selecting wrong columns or missing commas.
5fill in blank
hard

Fill all three blanks to insert a new user with name 'Alice' and age 25 into the users table.

PostgreSQL
INSERT INTO users ([1], [2]) VALUES ([3], 25);
Drag options to blanks, or click blank then click option'
Aname
B'Alice'
Cage
D'25'
Attempts:
3 left
💡 Hint
Common Mistakes
Putting numeric values in quotes.
Mixing up column names and values.