0% found this document useful (0 votes)
15 views3 pages

Chapter 1

Chapter 1 introduces Structured Query Language (SQL) as a key programming language for managing data in databases, emphasizing the importance of tables, records, and fields. It discusses best practices for naming conventions, unique identifiers, and the organization of data across multiple tables for efficient analysis. Additionally, it covers data types, including strings, integers, and floats, and explains the concept of a schema as the blueprint of a database.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views3 pages

Chapter 1

Chapter 1 introduces Structured Query Language (SQL) as a key programming language for managing data in databases, emphasizing the importance of tables, records, and fields. It discusses best practices for naming conventions, unique identifiers, and the organization of data across multiple tables for efficient analysis. Additionally, it covers data types, including strings, integers, and floats, and explains the concept of a schema as the blueprint of a database.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Chapter 1

Chapter 1
Introduction to SQL
Goals

Understand databases & their structure

Structured Query Language (SQL)


Is the most widely used programming language for communicating data in databases.
It lets us quickly access, organize, and analyze large amounts of data with direct
commands, known as queries.
These large amounts of data are stored in a database.
Used to answer questions both within and across relational database tables.

Tables
Main building block of a database.

Table Naming
Clear
Refer to the data (ex: inventory, product & books)
Lowercase
Underscores (instead of spaces)

Note: In the world of databases, rows are often referred to as records and columns as
fields.

Record contains the data for an individual observation.


Fields contain one piece of information for every record in a table.

Field Naming
Lowercase
Underscores (instead of spaces)
Singular

1/3
Chapter 1

plural not allowed, because it refers to the information contained in that field for a
single record.
Different to the table and other fields.
two fields in a table cannot have the same name, and they should never share a
name with the table they are housed in so that it's clear whether field or table is
being referred to.

Unique Identifier (Key)


Tables include a special field containing a unique identifier for each record, sometimes
called a key.
A key value must be unique for every record.

Note: Using several, well-organized tables is often better than putting everything into one big
table.

By keeping data in separate, related tables and connecting them with SQL, we can
analyze and answer questions more easily than we could with spreadsheets.

Database Storage
A Data is stored on a Server's Hard Disk.
Servers are powerful computers that store information and perform services via
requests made over a network.
Servers can handle a large number of data requests simultaneously, making them
ideal for collaboration.

Data Types
The Data type depends on the specific information stored in the field, such as numbers,
texts or dates.
We also want to consider the type of operations that we want to apply to that
information.

Strings
A "string" is a sequence of characters such as letters, numbers or punctuation.
SQL has several different data types that can hold strings.
VARCHAR - a commonly used data type due to its flexibility to store small or large
strings.

2/3
Chapter 1

Integers
An "integer" data type store whole numbers
INT - a common SQL integer data type

Floats
A data type that stores a fractional part or a decimal point
NUMERIC - the NUMERIC data type can store up to 38 digits total, including those
before and after the decimal point.

Schema
Often referred to as blueprints of databases.
A schema shows a database's design, such as what tables are included, any
relationships between its tables, and what data type each field can hold.

3/3

You might also like