1⃣Hi everyone, let's start as promised yesterday.

A quick note before starting, check @levikul09 for statistics and python related information.

These tweets are my notes from @OReillyMedia #LearningSQL book chapter 1. All the credit goes to that book.
2⃣What is a database? Why it is important in data world?

Well this is easy to answer, there are nearly 2.5 quintillion bytes of data created every day. So it is crucial that this data stored in someplace. That place is called a Database, a set of related information.
2
3⃣Today we are using Relational Database model most of the time. Before, there were Non-Relational Systems:

☑️Hierarchical Database Systems - same as Decision Trees
☑️Network Database Systems - sets of records and sets of link that defines the relationship
4⃣ The Relational Model

☑️The main idea came up with 'A relational model of data for large shared data banks.'

This model uses the relation links between tables.

☑️Each table in the database includes info that uniquely identifies a row, which is called a Primary Key
5⃣ However, it can be chosen a different key rather than the primary key. The selected key is now referred to as a Natural Key; in this situation, the primary key is called the Surrogate key.
6⃣ Now, let's take a step outside from the book, and google a bit what these keys are.

☑️ Natural keys are already in the database such as ID number, invoice ID etc.
▶️ No additional indexing is required if we have a natural key, however, if it's a string JOINS are too slow
7⃣ Surrogate Keys are meaningless in the data, just used for ordering.
▶️ JOINS are fast, however, an additional index is required

So to my understanding, natural keys are columns in the data and we use them as primary keys; surrogate keys are keys for ordering.
8⃣ In RDB, these keys give us a great simplicity; if your name changes after marriage, we only change the Name data from 1 table, and your ID stays the same in that database.
Storing data uniquely as each independent piece of info is in only one place is called NORMALIZATION
9⃣ SQL Related Terminology
Attached table summarizes briefly and clearly, check it out. Chapter 1, A little Background, Learning SQL, Barleau, A., O
🔟 What is SQL?

☑️ It is not short for Structured Querry Language, it is short for Sequel which is how you read SQL :)

☑️ SQL is a language to manipulate relational databases.

☑️SQL is good for RDB cause its output returns as a table.
1⃣1⃣ SQL is divided into several distinct parts.

☑️ SQL Schema Statements, define data structures stored in DB
☑️ SQL Data Statements, manipulate schema statements
☑️ SQL transaction statements, begin-end-roll back transactions (talk about later)
1⃣2⃣ CREATE TABLE statement is SQL schema statement, INSERT INTO is a SQL data statement and SELECT * FROM x is a SQL transaction statement.
🔚 Well, it was a bit long for a beginning tread. However, this was my notes on Chapter I.
Tomorrow, I will continue with Chapter II (not sure if I can finish it, but we'll see where it goes).

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Orkun Tahir Aran, PhD

Orkun Tahir Aran, PhD Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(