0
0
PostgreSQLquery~10 mins

Character types (char, varchar, text) in PostgreSQL - Interactive Code Practice

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

Complete the code to create a column that stores fixed-length character data of length 10.

PostgreSQL
CREATE TABLE users (username [1](10));
Drag options to blanks, or click blank then click option'
ATEXT
BVARCHAR
CCHAR
DINT
Attempts:
3 left
💡 Hint
Common Mistakes
Using VARCHAR instead of CHAR for fixed-length data.
Using INT which is for numbers, not characters.
2fill in blank
medium

Complete the code to create a column that stores variable-length character data up to 255 characters.

PostgreSQL
CREATE TABLE products (description [1](255));
Drag options to blanks, or click blank then click option'
AVARCHAR
BTEXT
CCHAR
DBOOLEAN
Attempts:
3 left
💡 Hint
Common Mistakes
Using CHAR which always uses fixed space.
Using TEXT which has no length limit.
3fill in blank
hard

Fix the error in the code to create a column for long text without length limit.

PostgreSQL
CREATE TABLE articles (content [1]);
Drag options to blanks, or click blank then click option'
ATEXT
BCHAR
CVARCHAR
DINT
Attempts:
3 left
💡 Hint
Common Mistakes
Specifying a length with TEXT which is not allowed.
Using INT which is for numbers.
4fill in blank
hard

Fill both blanks to create a table with a fixed-length code and a variable-length name.

PostgreSQL
CREATE TABLE items (code [1](5), name [2](100));
Drag options to blanks, or click blank then click option'
ACHAR
BTEXT
CVARCHAR
DINT
Attempts:
3 left
💡 Hint
Common Mistakes
Using TEXT for code which should be fixed length.
Using INT for character data.
5fill in blank
hard

Fill all three blanks to create a table with a fixed-length ID, a variable-length title, and a long text body.

PostgreSQL
CREATE TABLE posts (id [1](8), title [2](200), body [3]);
Drag options to blanks, or click blank then click option'
ACHAR
BVARCHAR
CTEXT
DINT
Attempts:
3 left
💡 Hint
Common Mistakes
Using INT for character fields.
Using TEXT with length specification.