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.

@r0deo
Copy link

r0deo commented Apr 15, 2024

  1. SQL is stand for structure query language, and mySql is a database management system where you can manage your data

  2. DBMS means database management system , Relational Database Management System (RDBMS), NoSQL Database Management System,Object-Oriented Database Management System (OODBMS)

  3. inner join, => SELECT employees.name, departments.department_name
    FROM employees
    INNER JOIN departments ON employees.department_id = departments.department_id;
    left join => SELECT customers.name, orders.order_number
    FROM customers
    LEFT JOIN orders ON customers.customer_id = orders.customer_id;
    right join => SELECT orders.order_number, order_items.quantity
    FROM orders
    RIGHT JOIN order_items ON orders.order_id = order_items.order_id;
    full join => SELECT customers.name, orders.order_number
    FROM customers
    FULL JOIN orders ON customers.customer_id = orders.customer_id;

  4. A Primary key is a unique identifier for each record in a database table.

A. Arithmetic Operators
B. Comparison Operators
C. Logical Operators
D. Concatenation Operator
E. NULL Comparison Operators
F. Pattern Matching Operators
G. IN Operator
H. BETWEEN Operator
I. EXISTS Operator
J. ANY, ALL Operators
K. Assignment Operator

5.Overall, group functions play a crucial role in SQL by enabling us to summarize, analyze, and gain insights from data efficiently, which is essential for decision-making, reporting, and ensuring data integrity.

  1. one to one, one to many , many to many

Ali, Hanan , Shinak, Sarah

@RafeefThamer
Copy link

RafeefThamer commented Apr 15, 2024

1- SQL is Structured Query Language while mysql is a database system
2- DBMS mean data base management system. MySQL is an example of it. It is a system that allows the user to manage data
Relational Database Management Systems (RDBMS)
NoSQL Databases
In-Memory Databases
Columnar Databases
Document Stores
Graph Databases
Time-Series Databases
NewSQL Databases
3-INNER JOIN: Returns rows when there is a match in both tables.
LEFT JOIN (or LEFT OUTER JOIN): Returns all rows from the left table and matched rows from the right table.
RIGHT JOIN (or RIGHT OUTER JOIN): Returns all rows from the right table and matched rows from the left table.
FULL JOIN (or FULL OUTER JOIN): Returns all rows when there is a match in either table.
SELF JOIN: Returns the Cartesian product of the two tables.
A primary key is a column or a set of columns in a relational database table that uniquely identifies each record (row) in that table. It must contain unique values, and no two rows can have the same primary key value. Additionally, a primary key column cannot contain NULL values.
4-Arithmetic Operators
Comparison Operators
Logical Operators
Compound Operators
bitwise operators
5-Group functions are vital in SQL for doing calculations on groups of rows rather than one row at a time. They help summarize data and create overall results from many rows.
6-Relationships in databases are logical connections between tables based on shared fields. There are four main types:
One-to-One (1:1)
One-to-Many (1:N)
Many-to-One (N:1)
Many-to-Many (N:M)

Rafeef Thamer, Mawj M.Basher, Shkar Gharib

@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