0
0
PostgreSQLquery~30 mins

Integer types (smallint, integer, bigint) in PostgreSQL - Mini Project: Build & Apply

Choose your learning style9 modes available
Working with Integer Types in PostgreSQL
📖 Scenario: You are creating a simple database table to store information about employees in a company. Each employee has an ID number, their age, and their salary in whole dollars.Different integer types can store different ranges of numbers. You will practice creating a table using smallint, integer, and bigint types to store these values efficiently.
🎯 Goal: Create a PostgreSQL table named employees with three columns: employee_id as smallint, age as integer, and salary as bigint. This will help you understand how to use different integer types for different data sizes.
📋 What You'll Learn
Create a table named employees
Add a column employee_id with type smallint
Add a column age with type integer
Add a column salary with type bigint
💡 Why This Matters
🌍 Real World
Companies often store employee information in databases. Choosing the right integer type helps save space and improves performance.
💼 Career
Database administrators and developers must understand data types to design efficient and reliable database schemas.
Progress0 / 4 steps
1
Create the employees table with employee_id as smallint
Write a SQL statement to create a table called employees with one column named employee_id of type smallint.
PostgreSQL
Need a hint?

Use CREATE TABLE employees (employee_id smallint); to create the table with the correct column and type.

2
Add the age column with type integer
Modify the employees table creation SQL to add a second column named age with type integer after employee_id.
PostgreSQL
Need a hint?

Add age integer as a new column separated by a comma.

3
Add the salary column with type bigint
Extend the employees table creation SQL to include a third column named salary with type bigint after age.
PostgreSQL
Need a hint?

Add salary bigint as the last column with a comma before it.

4
Complete the table creation with all three columns
Ensure the full SQL statement creates the employees table with columns employee_id as smallint, age as integer, and salary as bigint.
PostgreSQL
Need a hint?

Check that all three columns and their types are included in the table creation statement.