What is a database
a persistent structured collection of data that allows people to extract information in a way that meets their needs
What is a single-table datatbase
a database contains only one table
Why are databases useful
» if any changes or additions are made it only has to be done once – data is consistent
» the same data is used by everyone
» data is only stored once in relational databases which means no data duplication.
What are databases used for
Info about people
Info about things
Info about events
What is a record
a collection of fields that describe one item
horizontal rows
What is a field
vertical columns
What is a datatype
a classification of how data is stored and displayed, and of which operations that can be performed on the stored value
what are the 6 basic data types
» text/alphanumeric
» character
» Boolean
» integer
» real
» date/time
What is a primary key
a field in a database that uniquely identifies a record
What is SQL
Structured Query Language - standard query language for writing scripts to obtain useful information from a database
What is an SQL script
list of SQL commands that perform a given task
What is SELECT
Fetches specified fields (columns) from a table; queries
always begin with SELECT
what is FROM
Identifies the table to use
what is WHERE
Includes only records (rows) in a query that match a given condition.
what is ORDER BY
Sorts the results from a query by a given column either alphabetically or numerically.
what is SUM
Returns the sum of all the values in a field (column)
what is COUNT
Counts the number of records (rows) where the field (column) matches a specified condition
all queries end with what
;
how to select all
SELECT *
Describe text/alphanumeric (data type)
A number of characters
Describe Character (data type)
A single character
Describe Boolean (data type)
One of two values:
either True or False, 1 or 0, Yes or No
Describe Integer
Whole number
Describe Real (data type)
A decimal number
Describe date/time
Date and/or time
Format to access date/time in SQL
Select * FROM tablename WHERE colname = ‘22/11/2022’
need quotations and ‘/’