Basic Queries MySQL part 2 (Let's fill the table up!) π
Beginner Friendly!
Thread π§΅
β What are the keys in a relational database?
Keys help you uniquely identify a row in the table. It is also used to create relationship amongst various tables in a database.
The major types of keys:-
Primary Key
Candidate Key
Super Key
Foreign Key
Super Key: A set of one or more attributes or columns that identify a row/record in the table. It may consist of some columns that are not needed for the unique identification of a row.
Primary Key: A column or a group of columns that can uniquely identify a row/record in the table can become the primary key. It cannot have null or duplicate values in it. It is used to create relationships b/w different tables in a database.
Candidate Key: A set of columns that uniquely identifies a record. It is a super key with no repeated attribute, i.e. the minimal super key is a candidate key, or the candidate key is the proper subset of the super key.
Note: Proper Subset -> If A={1,4,3,5} then B={1,3} is a proper subset of A.
Foreign Key: It is a column of the table used to indicate the primary key of another table. It acts as a cross-reference between two tables.
β What are CONSTRAINTS?
They are the rules for the columns
Types of Constraints:-
NOT NULL - Guarantees that a column cannot have a NULL value or empty value
UNIQUE - Ensures that all values in a column are different
PRIMARY KEY - A combination of NOT NULL and UNIQUE values
DEFAULT - Sets a default value for a column if no value is specified
CHECK - Ensures the values in a column satisfy a specific condition
β Data Types in MySQL
To get you going:- 1. int -> integer (for non decimal values like 1, 2, 3) 2. varchar(size) -> a variable-length string up to a size defined by you
More:-
https ://bit.ly/2S4KHeI
β Inserting Values in a table
Single value at a time: insert into table_name values (data1, data2, data3....)
OR
Multiple values at once: insert into table_name values (data1, data2...), (data1, data2)
β To fetch data from the table, we use the SELECT statement.
Now, we want to fetch all the data we added into the classroom1 table.
For that we do:-
select * from table_name;
* -> means ALL
Practice Yourself:- 1) Download MySQL 2) Create a database named "College" 3) Create 3 Tables named "Students", "Teachers", "Departments" 4) Fill those tables using columns and their constraints
β’ β’ β’
Missing some Tweet in this thread? You can try to
force a refresh
SQL is a crucial skill for a Data Scientist! I would be releasing everything I know, little by little, and then a compiled version of all the threads you could revisit.
A Beginner's Guide to MySQL basic queries π -Part 1 (Creation of Everything!)
Thread π§΅
What is a database?
An organised collection of data that can be interrelated & makes operations like retrieval, insertion & deletion of data efficient.
User can perform different queries to perform an action based on their requirements.
Types:-
Hierarchical
Network
OO Database
A relational database is a type of database that stores everything in relations or tables.
Tables have columns and rows.
SQL -> Structured Query Language used to interact with a relational database.
I had attended a webinar recently and learnt something incredibly unique! I discovered that you could be a Data Scientist, but having a #specialisation is IMPORTANT!
What is a "specialisation"? How many kinds of specialisations are there in #DataScience Domain?
βοΈData Visualisation
If you have a knack for producing beautiful graphical representations from the data, this could be your domain of specialisation, and you could become a Data #Visualisation Engineer.
You want to step into the field of DATA. But do you know which area is best suited for you?
Compare your skills with the domain you are interested!!
Threadπ§΅
βοΈData Analyst
If you don't know what role Data Analyst plays, check out this (cutt.ly/VndBSnI)
Skills:-
Python and R
SQL
Excel
Data Visualisation Tools πππ
Report Building Tools (like Power BI & Tableau)
Communication, Presentation & Critical Thinking skills
βοΈMachine Learning Engineer
If you don't know what role Machine Learning Engineer plays, check out this (cutt.ly/VndBSnI)
Data Analytics is the fundamental step towards building a career in Data Science. It uses pre-existing data or historical data to solve a given problem. It includes tasks like checking hypothesis, creating dashboards & reports and gathering data from various sources.
One should be adept at working with tools like Power BI to generate reports, Microsoft Excel and SQL to work with structured or unstructured data, and proficient in R and Python.
Data Science is a multidisciplinary field. It includes Computer Science, Mathematics, Statistics, Economics, etc. It is NOT a subset of Machine Learning. Data Scientist may use machine learning to discover new insights from the data, but not necessarily.