- What is the difference between SQL and MySQL?
- What do you mean by DBMS? What are its different types?
- What are the types of joins in SQL? Give an example for each one.
- What is a Primary key?
- What are the different operators available in SQL?
- What is the need for group functions in SQL?
- What is a Relationship and what are they?
Please discuss these questions with your partners and post your answers as a comment on this gist when you are finished.
Emihle Matyolo
Sinethemba Zulu
Pumlani Kewana
MySQL is the underlying technology that stores the data, while SQL is the language you use to read, modify, and delete that data. SQL is a query programming language for managing Relational Database Management System. In contrast, MySQL is an Relational Database Management System that employs SQL. So, the major difference between the two is that MySQL is software, but SQL is a database language
A DBMS is software that allows you to work with a database. It manages and interacts with the database’s structure and stored information.
Types of DBMS are:
Types of SQL Joins:
INNER JOIN: Retrieves matching rows from both tables.
Example:
SELECT * FROM Orders INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID;
LEFT JOIN (or LEFT OUTER JOIN): Retrieves all rows from the left table and matching rows from the right table.
Example:
SELECT * FROM Customers LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID;
RIGHT JOIN (or RIGHT OUTER JOIN): Similar to LEFT JOIN but includes all rows from the right table.
Example:
SELECT * FROM Orders RIGHT JOIN Customers ON Orders.CustomerID = Customers.CustomerID;
FULL JOIN (or FULL OUTER JOIN): Retrieves all rows from both tables.
Example:
SELECT * FROM Customers FULL JOIN Orders ON Customers.CustomerID = Orders.CustomerID;
A primary key uniquely identifies each record in a table. It must contain unique values and cannot be NULL..A table can have only one primary key, which can consist of one or multiple columns
Common operators include:
= (equal)
!= or <> (not equal)
This function is important when you want to analyze and summarize information from multiple records in a data structure. The basic group functions are COUNT, SUM, AVG, MAX, and MIN.
In databases, relationships define how tables are related to each other.
Common types:
One-to-One: Each record in one table corresponds to exactly one record in another.
One-to-Many: Each record in one table can relate to multiple records in another.
Many-to-Many: Multiple records in one table relate to multiple records in another (requires a junction table).