Skip to content

Instantly share code, notes, and snippets.

@halitbatur
Last active November 5, 2021 19:17
Show Gist options
  • Save halitbatur/36b9a757e6679b53b191d8e83bb7befc to your computer and use it in GitHub Desktop.
Save halitbatur/36b9a757e6679b53b191d8e83bb7befc to your computer and use it in GitHub Desktop.
SQL discussion questions

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.

@ecelkl
Copy link

ecelkl commented Nov 4, 2021

1.SQL is a language to query databases and MySQL is an an RDBMS. SQL is used to operate manage and access to databases. MySQL allows people to keep the data in a database organized. MySQL uses SQL to query databases. SQL has a standard format since it is a language. MySQL always gets new updates.

  1. DBMS is a computerized data keeping system where users could perform several kinds of operations on that data.
    it has four types main types:
    Hierarchical database
    Network database
    Relational database
    Object-Oriented database

  2. Inner, Outer, Left, Right
    Inner join: return values matches both tables.
    Left join: return all records from the left table and the part matches the right table.
    The following code will select all customers, and any orders they might have:

SELECT Customers.CustomerName, Orders.OrderID
FROM Customers
LEFT JOIN Orders ON Customers.CustomerID = Orders.CustomerID
ORDER BY Customers.CustomerName;

Right join: return all records from the right table and the part matches the left table.
The following SQL statement will return all employees, and any orders they might have placed

SELECT Orders.OrderID, Employees.LastName, Employees.FirstName
FROM Orders
RIGHT JOIN Employees ON Orders.EmployeeID = Employees.EmployeeID
ORDER BY Orders.OrderID;

Full Outer join: return all values that matches with both table

  1. Primary Key: a column or a group of columns in the table that describes and identifies each row in that table.

  2. 1-Addition: Adding numbers with “+” sign.
    2-Subtraction: Subtracts a number from another with “-” sign.
    3-Multiplication: Multiplies two numbers with “*” sign
    4-Division: Divides one number by another with “/” sign.
    5-Remainder/Modulus:”%” sign returns the remainder from a division.
    6- & (Bitwise AND): “&” symbol compares each bit in a value with its corresponding bit in another value.
    7- &= (Bitwise AND Assignment)
    8- | (Bitwise OR)
    9- |= (Bitwise OR Assignment)
    10- ^ (Bitwise Exclusive OR)
    11- ^= (Bitwise Exclusive OR Assignment)
    12- = (Equal to)
    13- != (Not Equal to)
    14- > (Greater Than)
    15- !> (Not Greater Than)

  3. Group functions are mathematical functions to operate on sets of rows to give one result per set.
    COUNT MAX MIN AVG SUM
    It enables you to group data more clearly and logically, and to summarize data more effectively.

  4. Relationship: relation between tables

Room 8, W/ Amr Nashwaty, Mehmet Fatih Erdem

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