Hamburger Icon
  • Labs icon Lab
  • Data
Labs

SQL Fundamentals: Introduction to Databases and Table Structures

Master the basics of MySQL in this hands-on course. You'll learn how to create, manage, and query databases and tables, gaining essential skills in SQL. Starting with an introduction to database concepts, you'll explore pre-populated and new databases, create tables, and work with data types and null values. This course is ideal for beginners and those looking to strengthen their SQL skills, providing a solid foundation in MySQL fundamentals.

Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 11m
Published
Clock icon Sep 05, 2024

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Introduction to Databases

    SQL Guide

    For each task, replace or update the existing SQL code in the top panel (main.sql) with your answer to the task and run it to see the results in the bottom panel (SQL Viewer).

    Remember to toggle the database in the SQL Viewer to either SampleDB or CompanyDB as specified in the task before running your query.


    Step 1: Introduction to Databases

    To review the concepts covered in this step, please refer to the Database Fundamentals module of the Introduction to SQL video course.

    In this step, you will explore a pre-populated database, SampleDB, to learn how to navigate and understand basic database structures. You will practice listing databases, exploring tables, and examining the structure of tables. Finally, you’ll set up a new, empty database, CompanyDB, which you will use in the subsequent steps to create and manage tables.

    📚 Real-World Context In the world of data management, large organizations often deal with multiple databases that store critical information across different departments. For instance, a global enterprise might maintain separate databases for customer relationship management (CRM), human resources, and financial records. Before making any changes or performing analysis, a database administrator must first understand the landscape by listing available databases, exploring their contents, and examining the structure of key tables. This foundational step ensures that the administrator can navigate the organization’s data architecture with confidence, maintain data integrity, and support informed decision-making across the business.
  2. Challenge

    Creating Tables

    SQL Guide

    For each task, replace or update the existing SQL code in the top pane (main.sql) with your answer to the task and run it to see the results in the bottom pane.

    Remember to toggle the database in the SQL Viewer to CompanyDB before running your query, as this is where you’ll be creating new tables.


    Step 2: Creating Tables

    To review the concepts covered in this step, please refer to the course Database Fundamentals module of the Introduction to SQL course.

    In this step, you will learn how to define and create tables with appropriate data types and constraints. You'll practice creating and verifying the structure of tables that will store customer and product information in the CompanyDB database, building a solid foundation for your database.

    📚 Real-World Context Imagine a startup launching an online marketplace where vendors can sell products to consumers. To build the underlying infrastructure, the database team must design tables that accurately represent the business model. For example, a `Customers` table captures user information, while a `Products` table stores details about the items listed for sale. These tables must be designed with precision, using appropriate data types and constraints to ensure data accuracy and consistency. By constructing a well-organized database schema, the company can streamline operations, enhance the user experience, and scale its platform as it grows.
  3. Challenge

    Data Types and Null Values

    SQL Guide

    For each task, replace or update the existing SQL code in the top pane (main.sql) with your answer to the task and run it to see the results in the bottom pane. Ensure the CompanyDB database is selected in the SQL Viewer, as this is where you’ll be performing the following operations.


    Step 3: Data Types and Null Values

    To review the concepts covered in this step, please refer to the course Database Fundamentals module of the Introduction to SQL course.

    In this step, you will deepen your understanding of SQL data types and how to handle null values in tables. You will modify an existing table by adding a new column, practice inserting data of various types, and retrieve records based on null conditions. Additionally, you will create a new table to explore the practical use of different data types, reinforcing your knowledge of SQL table management.

    📚 Real-World Context Consider a healthcare provider managing patient records. Each patient profile may include essential information such as date of birth, contact details, and insurance coverage. However, not all fields are mandatory—some patients may choose not to provide secondary contact numbers or social security numbers. By carefully selecting data types and allowing null values where appropriate, the provider can create a flexible yet reliable database that accommodates varying levels of information while ensuring that critical data remains accurate. Additionally, when handling billing and insurance claims, using the correct data types, such as `DECIMAL` for financial amounts, is crucial to avoid errors in calculations and reporting.

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.