Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Learn SQL Database Programming
Learn SQL Database Programming

Learn SQL Database Programming: Query and manipulate databases from popular relational database servers using SQL

eBook
AU$33.99 AU$48.99
Paperback
AU$60.99
Subscription
Free Trial
Renews at AU$24.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Learn SQL Database Programming

Introduction to Relational Database Management Systems

This chapter introduces the concepts required to understand the basics of relational database management systems (RDMS). It will introduce foundational topics such as SQL, the relational model, data integrity, database normalization, and the types of relational database management systems. It will provide you with fundamental knowledge about SQL and databases that will be required throughout this book.

In this chapter, we will cover the following topics:

  • Understanding SQL
  • Understanding databases
  • Understanding data integrity
  • Understanding database normalization
  • Types of RDMS

Understanding SQL

Structured Query Language, or SQL (pronounced see-quel), is the language that is used for querying and manipulating data and defining structures in databases. Initially developed at IBM in the early 1970s, SQL became an ANSI and ISO standard in 1986.

SQL is a powerful, yet simple language, and can do many things, such as execute queries, retrieve, insert, update, and delete data, create databases and tables, and much more.

These types of activities can be grouped into different subdivisions of SQL: Data Definition Language (DDL), Data Manipulation Language (DML), and Data Control Language (DCL):

  • Use DDL commands to specify database schema:
  • CREATE: This is used to create a new database or objects in a database.
  • ALTER: This is used to alter a database or objects in a database.
  • DROP: This is used to delete a database or objects in a database.
  • TRUNCATE: This is...

Understanding databases

A database is a collection of data. You store databases in a relational database management system (RDMS). The RDMS is the basis for modern database systems like MySQL, SQL Server, Oracle, PostgreSQL, and others. These will be covered in more detail later in this chapter.

Tables

In an RDMS, objects called tables store data. Tables are a collection of related data stored in columns and rows. The following screenshot is a cross-section of a table that contains data about baseball players' appearances in all-star games:

A NULL value in a table is a value that appears to be blank. It doesn't represent a string of blank spaces, zero, or a zero-length character string: it's a missing or unknown...

Understanding data integrity

Data integrity refers to the consistency and accuracy of the data. It is typically enforced by the procedures and guidelines in the database design phase. In RDMS, keys enforce data integrity. A key is user-defined and forces values in a table to conform to a specified standard. This standard will allow only certain kinds of values to be in the database.

Types of integrity

Data integrity refers to the consistency and accuracy of data and table relationships. The following table lists the types of integrity you can use:

Entity integrity

Referential integrity

Domain integrity

Unique constraint

Foreign key

Check constraint

Not null constraint

Default constraint

Primary key...

Database normalization

Database normalization is the process of putting your raw data into tables using rules to avoid redundant data, optimize database performance, and ensure data integrity.

Without proper normalization, not only can you have data redundancy, which uses additional storage space, but it can be more difficult to update and maintain the database without data loss.

Normalization requires forms. Forms are sets of rules to follow to normalize your data into database tables. There are three forms that we will discuss: the first normal form, the second normal form, and the third normal form. Each of these forms has a set of rules to ensure that your database complies with the form. Each of the forms builds on the previous forms.

The first normal form

...

Types of RDMS

An RDMS is a database that stores data in tables using rows and columns. The values in the tables are related to one other, and the tables may also be related to one another, hence the term relational. This relationship makes it possible to access data across multiple tables with a single query.

In this section, we will review the top four relational database management systems. The top four are Oracle, MySQL, SQL Server, and PostgreSQL.

According to the DB-Engines Ranking, here are the scores for the top RDMSes at the time of writing this book:

The preceding screenshot can be found at https://db-engines.com/en/ranking.

Oracle

Oracle was first released in 1979. Oracle was the first commercially available SQL...

Summary

This chapter introduced the concepts required to understand the basics of relational database management systems. It introduced you to foundational topics such as understanding SQL, what SQL can do, and its basic components. You learned that there are three subdivisions of SQL called DML, DDL, and DCL, and that the SQL language is comprised of several elements that make up a statement. We walked through a description of the relational model, what a database is, and what is in a database, including what a table, row, column, and field are.

We followed with an explanation of data integrity, including the different types of data integrity, such as entity, referential, and domain integrity, and looked at how to use keys and constraints. This understanding of data integrity helped you understand database normalization, including the different forms of normalization, 1NF, 2NF...

Questions

  1. What is SQL?
  2. What are the different subdivisions of SQL?
  3. What are the elements of a SQL statement?
  4. What are the reasons to normalize a database?
  5. What are the levels of database normalization?
  6. What is data integrity?
  7. What are the different ways you can enforce data integrity?
  8. What types of RDMS exist?
  9. What is the main advantage of MySQL?
  10. What is the main disadvantage of Oracle and SQL Server?
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Explore all SQL statements in depth using a variety of examples
  • Get to grips with database querying, data aggregate, manipulation, and much more
  • Understand how to explore and process data of varying complexity to tell a story

Description

SQL is a powerful querying language that's used to store, manipulate, and retrieve data, and it is one of the most popular languages used by developers to query and analyze data efficiently. If you're looking for a comprehensive introduction to SQL, Learn SQL Database Programming will help you to get up to speed with using SQL to streamline your work in no time. Starting with an overview of relational database management systems, this book will show you how to set up and use MySQL Workbench and design a database using practical examples. You'll also discover how to query and manipulate data with SQL programming using MySQL Workbench. As you advance, you’ll create a database, query single and multiple tables, and modify data using SQL querying. This SQL book covers advanced SQL techniques, including aggregate functions, flow control statements, error handling, and subqueries, and helps you process your data to present your findings. Finally, you’ll implement best practices for writing SQL and designing indexes and tables. By the end of this SQL programming book, you’ll have gained the confidence to use SQL queries to retrieve and manipulate data.

Who is this book for?

This book is for business analysts, SQL developers, database administrators, and students learning SQL. If you want to learn how to query and manipulate SQL data for database administration tasks or simply extract and organize relevant data for analysis, you’ll find this book useful. No prior SQL experience is required.

What you will learn

  • Install, configure, and use MySQL Workbench to restore a database
  • Explore different data types such as string, numeric, and date and time
  • Query a single table using the basic SQL SELECT statement and the FROM, WHERE, and ORDER BY clauses
  • Query multiple tables by understanding various types of table relationships
  • Modify data in tables using the INSERT, UPDATE, and DELETE statements
  • Use aggregate functions to group and summarize data
  • Detect bad data, duplicates, and irrelevant values while processing data

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 29, 2020
Length: 564 pages
Edition : 1st
Language : English
ISBN-13 : 9781838981709
Category :
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : May 29, 2020
Length: 564 pages
Edition : 1st
Language : English
ISBN-13 : 9781838981709
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
AU$24.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
AU$249.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just AU$5 each
Feature tick icon Exclusive print discounts
AU$349.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just AU$5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total AU$ 217.97
The SQL Workshop
AU$45.99
SQL for Data Analytics
AU$110.99
Learn SQL Database Programming
AU$60.99
Total AU$ 217.97 Stars icon
Banner background image

Table of Contents

23 Chapters
Section 1: Database Fundamentals Chevron down icon Chevron up icon
Introduction to Relational Database Management Systems Chevron down icon Chevron up icon
Installing and Using MySQL Workbench Chevron down icon Chevron up icon
Understanding Data Types Chevron down icon Chevron up icon
Designing and Creating a Database Chevron down icon Chevron up icon
Importing and Exporting Data Chevron down icon Chevron up icon
Section 2: Basic SQL Querying Chevron down icon Chevron up icon
Querying a Single Table Chevron down icon Chevron up icon
Querying Multiple Tables Chevron down icon Chevron up icon
Modifying Data and Table Structures Chevron down icon Chevron up icon
Section 3: Advanced SQL Querying Chevron down icon Chevron up icon
Working with Expressions Chevron down icon Chevron up icon
Grouping and Summarizing Data Chevron down icon Chevron up icon
Advanced Querying Techniques Chevron down icon Chevron up icon
Programmable Objects Chevron down icon Chevron up icon
Section 4: Presenting Your Findings Chevron down icon Chevron up icon
Exploring and Processing Your Data Chevron down icon Chevron up icon
Telling a Story with Your Data Chevron down icon Chevron up icon
Section 5: SQL Best Practices Chevron down icon Chevron up icon
Best Practices for Designing and Querying Chevron down icon Chevron up icon
SQL Appendix Chevron down icon Chevron up icon
Assessments Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.2
(6 Ratings)
5 star 66.7%
4 star 0%
3 star 16.7%
2 star 16.7%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Alan Sep 13, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I studied relational database systems and SQL many years ago at post graduate level and needed to brush up on the subject. This book was exactly what I was looking for. The author is straight to the point and gives good examples. I enjoyed the book.
Subscriber review Packt
Matthew McDowell Nov 23, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Perfect beginner reference, the author has done a fantastic job! Easy to understand and a practical guide that can show you beginning steps to query a database as well as more advanced means off accessing and manipulating data. The book even goes into more advanced techniques for someone interested in database administration. This book goes over best practices in a clear manner with plenty of examples. As someone who works with relational databases on a daily basis, this book has helped me understand the fundamentals of what I knew how to do and has helped elevate the way I write queries. There is plenty left for me to learn and this book will continue to remain an invaluable tool!
Amazon Verified review Amazon
Bladwell Martinez Costas Jun 06, 2022
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Me agrado mucho este articulo.
Amazon Verified review Amazon
Vanessa Feb 13, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is very well-written and shows step by step how to manipulate data in SQL. It is written in an easy to read fashion, that helps the reader have an understanding of each query. There are many examples throughout to help show the process for a clear understanding of the fundamentals. There are also more advanced techniques shown, so the book isn't just for beginners either.
Amazon Verified review Amazon
Just Some Guy Jan 15, 2022
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
This isn't a bad book - it's actually pretty good. It's just not what the title claims. This book is good a good buy for 1 of these 2 use cases:1) You're brand new to using a real database (Excel and Access don't count), and you want a high-level introduction to using MySQL and writing SQL queries, etc.2) You're quite good with SQL and databases already, and you just want a reference on your desk you can flip open to check the syntax on part of your query, or similar reference-type needs.Besides that, I think this book is a miss. It's covers a lot of ground, but it moves really fast, and barely anything goes into much depth. As a result, if you're new to SQL then you won't actually *learn* much here (there are too few examples, and they never go into much depth) – but if you're a pro this is all pretty obvious, so you won't learn anything new.My main other complaint about this book is that for a book with "Programming" in the title, it barely meets that standard at all. Besides a quick pass on functions and stored procedures (which do involve programming via SQL), almost everything this book does is via the MySQL Workbench tool. Now, that's great if learning Workbench is your goal - but if you want to manage your database via APIs, or do anything programmatic whatsoever (via a language like Python, Java, etc.), this book has ZERO on ANY of that. The work "Programming" has no place in the title of this book.Two other minor complaints:1) There are some sloppy typos and technical errors that should have been caught by the editors - and that happened a couple times too many for me to ignore.2) The book really feels like the author was trying to pad the page count. There are a TON of screenshots (again, mostly of MySQL Workbench). While I usually like those, for reference, they were larger and more frequent than necessary. There are also pages of content that get very repetitive - like, the author would often repeat the same exact paragraph multiple times when explaining a list of things that were mostly the same, but had only slight differences. (for example, a full paragraph explaining an example with a logical TRUE/IN/= use case, and then the exact same paragraph repeated again but with just a couple words changed to explain the respective FALSE/NOT IN/!= use case). Pages of text could have been saved by using a more compact writing approach.All that said, this is a pretty good book for the 2 needs I mentioned at the top of this review. If that's you, buy it and make the most of it. But anyone wanting to really learn how to "program SQL" will need to read a few other books, too. Now you know.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.