SQL NOTES
SQL NOTES
Structure of a Database:
★ Table is a collection of related data entries and it consists of columns and
rows
★ Broken up into smaller entities calleds fields and records
★ Fields are Columns that are designed to maintain specific information about
every record in the table; etc PostalCode,Country,Address and City
★ Records are Rows is each individual entry that exists in table
★ A Key field makes a record unique:
○ construct, something that is unique for each record such as cell phone
number/ ID number
★ Database that has multiple tables, link them together by using key fields
Additional Information:
● Some large databases don’t use SQL because they don’t have structure such
as columns and records
○ Meaning they their databases have large unstructured data sets or
rapidly changing data structures
○ Advantage: Allow for quicker,easier data storage and access without
the need for a predefined schema
○ Example: MongoDB-Which is a document database with the scalability
and flexibility that you want to with the querying and indexing that you
need
● Most use JSON file format to store data
○ JavaScript Object Notation(JSON) - a standard text-based format for
representing structured data based on Javascript object syntax
■ Commonly used- For transmitting data in web applications:
■ Used to and storing data on the internet and transfer object data
file across the internet
● Therefore sending some data from the server to the client
so it can be displayed on a webpage
● Things such as sub queries
● Delete has 3 parts; specificity which table you are delete from and then; Need
a WHERE statement so that it doesn’t delete all info
DLSH4sql
Structure of Queries
** Use double hyphen to comment out statements
Format:
Select
From table_name
Join
On
Where/Having -- Having is used for calculation and can’t be used without GROUP BY
Group by
Order by
Examples(Containing Having):
Select *
From Orders
Group by Ship City
Having avg (Shipping fee) > 100