1⃣ Today, I'll continue with Chapter II. This chapter focuses on data types and creating / populating data.

Since I was aware of the data types, I try to summarize the chapter. For who are new to #SQL should read in detail.

For statistics related treads, see @levikul09.
2⃣ #MySQL Datatypes
1. Character data:
☑️ Fixed-length : right-pinned with spaces
☑️ Variable length : not padded, space consumption varies
i.e : char(20) - fixed ; varchar(20) variable length examples.
3⃣ Character Sets are used for different languages with different letters
Returns a table with different char sets. If maxlen bigger than 1, the chars in that language are bigger than 1 bytes. Image
4⃣ Text Data

There are 4 types of text data in #MySQL
tinytext
text
mediumtext
longtext

Which are ordered by the characters they can store. After #MySQL v.4 varchar can store 64 KB, so tinytext and text are not necessary.
Medium-longtext types are used restoring documents
5⃣ Numeric Data
Any numeric data can saved with same as text data samples (tiny, -, medium etc). And additionally, for decimals we have float(p,s) and double(p,s) types.

☑️ Temporal Data is refers to date type data. Types are date, datetime, timestamp, year and time.
6⃣ After visiting data types, let's see some samples of creating tables, inserting - update and delete data from table.

For that I will refer to my #github repo github.com/orkunaran/8wee… Image
7⃣ Insert Data
How to insert data into the created table

According to this table, we also need customer_names and products tables to determine products and customers. Image
8⃣ Let's UPDATE last row of the sales data, change product_id to 2 Image
9⃣ And finally, let's delete one of the rows

In this query, I deleted customer A's orders which are 2. Image
🔚 That's the end for today. I know the book will cover these in detail in later chapters. However, this chapter was a good wrap-up.

I hope you liked the summaries I wrote here. See you tomorrow for a part of Chapter III (not sure I can finish it all )

All the best

• • •

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!

More from @orc_arn

Jun 3
Before sharing notes from Chapter IV, let's solve exercises in Chapter III ending.
1. Retrieve the actor ID, first name, and last name for all actors. Sort by last name and then by first name. Image
2. Retrieve the actor ID, first name, and last name for all actors whose last name equals 'WILLIAMS' or 'DAVIS'. Image
Read 5 tweets
Jun 2
Alright, let's get back to work. Feeling better already, and got some time to read Chapter III - Query Primer

Let's start
First, let's select data for the queries. I'll go with my Coffee Quality repo, the data is from @KaggleDatasets, you can access it there.

Now, back to Chapter.

This chapter is basically about #MySQL statements. It covers select, from, where, group by, order by and having.
2⃣ But first, it would be better to understand how SQL Server executes your queries. When we run a query, the server checks 3 things:
▶️ Permission to execute query
▶️ Permission to access database
▶️ Statement syntax
Read 14 tweets
May 30
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
Read 13 tweets

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!

:(