0
0
SQLquery~30 mins

SELECT all columns in SQL - Mini Project: Build & Apply

Choose your learning style9 modes available
Selecting All Columns from a Table
📖 Scenario: You are working with a small bookstore database. The database has a table called books that stores information about each book available in the store.
🎯 Goal: Learn how to write a SQL query that selects all columns from the books table to see every detail about each book.
📋 What You'll Learn
Create a table called books with columns id, title, author, and year_published.
Insert three specific book records into the books table.
Write a SQL query that selects all columns from the books table using SELECT *.
Complete the query with a semicolon ; to end the statement.
💡 Why This Matters
🌍 Real World
Selecting all columns is a common task when you want to see every detail stored in a database table, such as viewing all information about books in a bookstore.
💼 Career
Database administrators and developers often need to retrieve full records from tables to analyze data or build reports.
Progress0 / 4 steps
1
Create the books table
Write a SQL statement to create a table called books with these columns: id as an integer primary key, title as text, author as text, and year_published as an integer.
SQL
Need a hint?

Use CREATE TABLE books (column definitions); with the exact column names and types.

2
Insert three books into the books table
Write three SQL INSERT INTO books statements to add these books exactly:
1. id=1, title='The Hobbit', author='J.R.R. Tolkien', year_published=1937
2. id=2, title='1984', author='George Orwell', year_published=1949
3. id=3, title='To Kill a Mockingbird', author='Harper Lee', year_published=1960
SQL
Need a hint?

Use three separate INSERT INTO books (columns) VALUES (values); statements with the exact data.

3
Write a query to select all columns from books
Write a SQL query that selects all columns from the books table using SELECT *.
SQL
Need a hint?

Use SELECT * FROM books to get all columns.

4
Complete the query with a semicolon
Add a semicolon ; at the end of the SELECT * FROM books query to complete the SQL statement.
SQL
Need a hint?

Remember to end SQL statements with a semicolon ;.