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.
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.
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
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