Database foundations
What is a database, and why does it matter?
From storing files to producing trustworthy information.
More than an article. A complete learning path.
65 lessons, 12 modules and explained examples at three levels. Follow the sequence or jump to a topic.
Understand the concept
A database is an organised collection of information governed by rules that make it reliably retrievable. In a shopping application, customers, products, orders and order lines are distinct entities. The database preserves not only the records but also which customer owns an order, the price of an item and the consistency of changes.
Excel and CSV are useful for analysis and data exchange. A database management system becomes important when many users update records concurrently, relationships must remain valid, permissions matter and failed operations need to be rolled back. The DBMS manages storage, querying, concurrency and recovery. SQL Server is a DBMS; SqlStudioLab is a database.
Good modelling stores each fact in its proper place. Instead of copying an email address into every order, keep it on the customer and reference that customer by a key. A change then updates one fact instead of creating conflicting copies. Database quality directly affects the accuracy of reports and the reliability of applications.
Use it to manage persistent application state, orders or measurements.
Treating a database as a large spreadsheet and ignoring relationships and concurrent work.
One topic. Three levels of depth.
SELECT DB_NAME() AS CurrentDatabase;Shows the current database: the first step in checking your environment.
This page does not execute SQL. Practise in the downloadable SqlStudioLab using SSMS. Before rerunning temporary-table examples, remove only the relevant #table. Views, procedures and functions create persistent lab objects; never use a production connection.
Try it yourself first.
Why should customers without orders remain visible? Query the customer count.
Show the solution and explanation
SELECT COUNT(*) AS CustomerCount FROM lab.Customer;The result is 6. Starting with an INNER JOIN to orders excludes some customers.