Skip to content

Instantly share code, notes, and snippets.

@halitbatur
Created January 2, 2024 13:21
Show Gist options
  • Save halitbatur/5a44d079ac9ba91933039adccb9cfd4f to your computer and use it in GitHub Desktop.
Save halitbatur/5a44d079ac9ba91933039adccb9cfd4f to your computer and use it in GitHub Desktop.
SQL Discussion

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.

@gorgees04
Copy link

Gorgees, Dana

What is the difference between SQL and MySQL?

  • SQL is a query language, whereas MySQL is a relational database that uses SQL to query a database.
  • SQL is commercial, MySQL is open source.

What do you mean by DBMS? What are its different types?

  • DBMS is system software for creating and managing databases. A DBMS makes it possible for end users to create, protect, read, update and delete data in a database.
    types
  • Relational DBMS (RDBMS): Uses a table-based format. Data is structured in rows and columns, forming relations. Examples: MySQL, PostgreSQL, Oracle, Microsoft SQL Server.
  • Hierarchical DBMS: Organizes data in a tree-like structure. Data is stored hierarchically with a parent-child relationship.
  • Network DBMS: Similar to hierarchical DBMS but allows each record to have multiple parent and child records.
  • Object-Oriented DBMS: Stores data in the form of objects, as in object-oriented programming.
  • Document-Oriented DBMS: Designed for storing, retrieving, and managing document-oriented information.
  • NoSQL DBMS: Designed for handling big data and real-time web applications. Non-relational and typically distributed.

What are the types of joins in SQL? Give an example for each one:

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

What is a Primary key?

  • The PRIMARY KEY constraint uniquely identifies each record in a table.
  • We can connect tables by PRIMARY KEY to make foreign keys.

What are the different operators available in SQL?

  • Arithmetic Operators (+, -, *, /, %)
  • Bitwise Operators (&, |, ^)
  • Comparison Operators (=, <, >,..etc)
  • Compound Operators (+=, -=, *=, ...etc)
  • Logical Operators (ALL, AND, ANY, ...etc)

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