Skip to Content
Getting Started with SQL
book

Getting Started with SQL

by Thomas Nield
February 2016
Beginner content levelBeginner
131 pages
2h 38m
English
O'Reilly Media, Inc.
Book available
Content preview from Getting Started with SQL

Chapter 10. Managing Data

In the previous chapter, we learned not only how to create a database but how to do it well. Well-considered table design, column constraints, and relationships will really shine once we start putting data into the tables. With our strong table design and the well-thought-out relationships between them, we will be able to join efficiently and easily. When a piece of data needs to be changed (e.g., a customer address), we only need to change it in one place rather than several. When a bad piece of data comes in, hopefully we have set enough sensible constraints to prevent it from entering the database.

In this chapter, we will learn how to INSERT, DELETE, and UPDATE records. Fortunately, writing operations like these is much simpler than writing SELECT statements.

These SQL write operations do not have to be done by a human. Software (written in Java, Python, or other coding languages) will often generate and execute SQL statements to read and write data the same way a human would, but much more efficiently. Although this is beyond the scope of this book, coding languages will be touched on in the next chapter if that is pertinent to you.

INSERT

In a relational database, data only exists if the database first receives records. The INSERT statement does just that and inserts a record into the database. You can pick what fields to populate in the record, and the rest of the fields will be null or use a default value.

First, we will INSERT an ATTENDEE record ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Head First SQL

Head First SQL

Lynn Beighley
SQL Fundamentals

SQL Fundamentals

Thomas Nield
Learning SQL

Learning SQL

Ben Forta

Publisher Resources

ISBN: 9781491938607Errata Page