Skip to content

Instantly share code, notes, and snippets.

@muslemomar
Created April 15, 2024 14:40
Show Gist options
  • Save muslemomar/4a96781574ea9f1e8383d3dc8fc024a3 to your computer and use it in GitHub Desktop.
Save muslemomar/4a96781574ea9f1e8383d3dc8fc024a3 to your computer and use it in GitHub Desktop.

SQL discussions

  1. What is the difference between SQL and MySQL?
  2. What do you mean by DBMS? What are its different types?
  3. What are the types of joins in SQL? Give an example for each one.
  4. What is a Primary key?
  5. What are the different operators available in SQL?
  6. What is the need for group functions in SQL?
  7. 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.

@IamAhmedly
Copy link

Ahmed Isam, Ibrahim muhaned, Helin tayeb, Didam Goran.
Q0-What is the difference between SQL and MySQL?
A-SQL is a language used for managing relational databases, while MySQL is a database management system.

Q1-What do you mean by DBMS? What are its different types?
A- DBMS, or Database Management System, is software facilitating data management tasks. Types include Relational (RDBMS), NoSQL, Object-Oriented, Hierarchical, Network, and Graph databases.

Q2-What are the types of joins in SQL? Give an example for each one.
(INNER) JOIN, LEFT (OUTER) JOIN, RIGHT (OUTER) JOIN, FULL (OUTER) JOIN:

  • SELECT * FROM table1 INNER JOIN table2 ON table1.column = table2.column;
  • SELECT * FROM table1 LEFT JOIN table2 ON table1.column = table2.column;
  • SELECT * FROM table1 RIGHT JOIN table2 ON table1.column = table2.column;
  • SELECT * FROM table1 FULL JOIN table2 ON table1.column = table2.column;

Q3- What is a Primary key?
A- Primary Key: A primary key is a column or a set of columns that uniquely identifies each row in a table. It must contain unique values and cannot contain NULL values. By defining a primary key, you ensure data integrity and provide a way to reference individual rows in the table

Q4-What are the different operators available in SQL?
A-

  • Comparison operators (e.g., =, <>, <, >, <=, >=)
  • Logical operators (e.g., AND, OR, NOT)
  • Arithmetic operators (e.g., +, -, *, /)
  • NULL-related operators (e.g., IS NULL, IS NOT NULL)
  • Set operators (e.g., UNION, INTERSECT, EXCEPT)

Q5- What is the need for group functions in SQL?
A-
The GROUP BY statement groups rows that have the same values into summary rows, like "find the number of customers in each country".
The GROUP BY statement is often used with aggregate functions (COUNT(), MAX(), MIN(), SUM(), AVG()) to group the result-set by one or more columns.

Q6- What is a Relationship and what are they?
A- A relationship in a relational database defines how data in one table is related to data in another table. There are three main types of relationships:

  • One-to-One: Each record in one table is related to only one record in another table.
  • One-to-Many: One record in one table can be related to multiple records in another table.
  • Many-to-Many: Multiple records in one table can be related to multiple records in another table.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment