0
0
SQLquery~30 mins

Column aliases with AS in SQL - Mini Project: Build & Apply

Choose your learning style9 modes available
Using Column Aliases with AS in SQL
📖 Scenario: You are managing a small bookstore database. The store wants to display a list of books with their titles and prices, but with clearer column names for reports.
🎯 Goal: Create a SQL query that selects the book title and price from the books table, and use column aliases with AS to rename the columns to Book_Title and Book_Price.
📋 What You'll Learn
Create a table called books with columns title (text) and price (numeric).
Insert three books with exact titles and prices.
Write a SELECT query that retrieves title and price from books.
Use AS to alias title as Book_Title and price as Book_Price.
💡 Why This Matters
🌍 Real World
Column aliases are used in reports and user interfaces to show friendly column names instead of raw database column names.
💼 Career
Knowing how to use column aliases is important for database querying, reporting, and data analysis roles.
Progress0 / 4 steps
1
Create the books table and insert data
Create a table called books with columns title (text) and price (numeric). Insert these three books exactly: 'The Great Gatsby' priced 10.99, '1984' priced 8.99, and 'To Kill a Mockingbird' priced 12.50.
SQL
Need a hint?

Use CREATE TABLE books (title TEXT, price NUMERIC); and then INSERT INTO books (title, price) VALUES (...), (...), (...);

2
Write a basic SELECT query
Write a SELECT query to get the title and price columns from the books table.
SQL
Need a hint?

Use SELECT title, price FROM books; to get the columns.

3
Add column aliases with AS
Modify the SELECT query to use AS to rename the title column to Book_Title and the price column to Book_Price.
SQL
Need a hint?

Use SELECT title AS Book_Title, price AS Book_Price FROM books; to rename columns.

4
Complete the query with aliases
Ensure the final query selects title as Book_Title and price as Book_Price from the books table. This completes the use of column aliases with AS.
SQL
Need a hint?

Make sure the query uses AS to rename both columns.