Week+1SQL
Week+1SQL
• define SQL,
• discuss how SQL differs from many other computer languages,
• explain the three primary ways SQL is used with the database, and
• compare and contrast the roles of a database administrator and a data
scientist.
• Along with discussing the importance of knowing what SQL syntax you're
using in a given database
What is SQL: This is the standard language for many relational database
management systems and data manipulation. SQL is used often to query,
insert, update, and modify data. At a basic level SQL is a method
for communicating between you and the database.
A data scientist, on the other hand, is typically a user of that database. The
DBA will be responsible for giving permissions to people and determining
who has access to what data. They're often times responsible for managing
the tables and creating them
Data Scientist uses SQL for: Retrieve data, may create their own table or
test environment, combine multiple sources, write complex queries
analysis.
Goals of video 3
Goals of video 4
The building blocks for this relational model are really three simple
things. We have entities which are a person, place, thing or event. These
are very distinguishable. They are unique. They are distinct. For example, I
could be an entity, Sadie St. Lawrence, and then we have attributes, which
are characteristics of this entity. As an entity, it would be myself and then an
attribute about me would be that I am female.
Then, the third building block of the model is the relationship. This
describes the association among different entities. One-to-many, many-to-
many, one-to-one are covered here.
"Persons" table:
PersonID LastName FirstName Age
1 Watkins Ben 10
2 Johnson David 12
3 Kevinson Kevin 11
4 Whatever Barack 9
"Orders" table:
OrderID OrderNo PersonId OrderDate
1 1234 14 1/1/2011
2 45677 15
3 123456 15
4 43210 10
RelationShip Notations:
SELECT statement
Goals:
• Write a basic SELECT statement
• Tell a database which table your data will come FROM
• SELECT either all or particular columns from a table in a query
• Limit the amount of data which is returned in a query.
SELECT column(s)_name
FROM table_name
e.g. output:
SELECT prod_name prod_name
FROM products Shampoo
Cologne
Camera
SELECT prod_name,
prod_id
FROM products