1. Home
  2. Explore
  3. Computer Science
  4. SQL Basics

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

SQL Basics

  • 35Unfamiliar
  • 0Learning
  • 0Familiar
  • 0Mastered
Topic: SQL Fundamentals
  • spaceFlip card
  • KI knew it
  • DI didn't know it
  • ←Previous card
  • →Next card

What does SQL stand for?

Tap to flipClick to flipspace

Structured Query Language

Or swipe the card

35 cards

  1. What does SQL stand for?

    Structured Query Language

  2. What is the primary use of SQL?

    To communicate with databases, performing operations like creating, reading, updating, and deleting data.

  3. What does CRUD stand for in SQL?

    Create, Read, Update, Delete

  4. What is a database?

    A system for storing large amounts of structured data in tables with rows and columns.

  5. What does DBMS stand for and what is its role?

    Database Management System; it manages databases, controlling access and organizing data.

  6. Name three examples of DBMS software.

    MySQL, Microsoft SQL Server, PostgreSQL (also Oracle)

  7. Is SQL an ISO standard?

    Yes, SQL is a standard ratified by the ISO.

  8. What are the two main types of databases?

    Relational (RDBMS) and non-relational (NoSQL).

  9. What makes a relational database 'relational'?

    Tables are related to each other through keys (e.g., primary and foreign keys).

  10. How do you install MySQL on Ubuntu?

    Run sudo apt update then sudo apt install mysql-server -y.

  11. How do you verify the MySQL service is running?

    Use sudo systemctl status mysql.

  12. How do you access the MySQL command shell?

    Type sudo mysql (or mysql -u root -p if password is set).

  13. Why must every MySQL command end with a semicolon?

    The semicolon tells MySQL that the command is complete and ready to execute.

  14. How do you list all databases in MySQL?

    Run SHOW DATABASES;

  15. How do you create a new database in MySQL?

    Run CREATE DATABASE database_name;

  16. How do you switch to a specific database in MySQL?

    Run USE database_name;

  17. How do you list all tables in the current database?

    Run SHOW TABLES;

  18. How do you create a new table in MySQL?

    Run CREATE TABLE table_name (column_name data_type, ...);

  19. What does the INT data type mean in MySQL?

    INT is a data type for integers (whole numbers).

  20. What does VARCHAR(n) mean in MySQL?

    Variable-length string with a maximum length of n characters.

  21. What is a schema in the context of databases?

    The structure and organization of tables and their columns in a database.

  22. How do you view the structure of a table?

    Run DESCRIBE table_name;

  23. How do you insert a row into a table in MySQL?

    Run INSERT INTO table_name VALUES (value1, value2, ...);

  24. How do you delete specific rows from a table?

    Run DELETE FROM table_name WHERE condition;

  25. How do you update existing records in a table?

    Run UPDATE table_name SET column = value WHERE condition;

  26. How do you select all columns from a table?

    Run SELECT * FROM table_name;

  27. How do you select only specific columns from a table?

    Run SELECT column1, column2 FROM table_name;

  28. How do you filter rows in a SELECT query?

    Add a WHERE clause: SELECT * FROM table_name WHERE condition;

  29. How do you combine multiple conditions in a WHERE clause?

    Use OR (or AND) between conditions: WHERE condition1 OR condition2

  30. How do you select rows where a condition is not true?

    Use the NOT operator: SELECT * FROM table_name WHERE NOT condition;

  31. How do you sort query results in ascending or descending order?

    Use ORDER BY column_name ASC (ascending) or DESC (descending).

  32. How do you add a new column to an existing table?

    Run ALTER TABLE table_name ADD column_name data_type;

  33. What is the purpose of the BOOLEAN data type in MySQL?

    To store true/false values.

  34. What is a primary key in a relational database?

    A unique identifier for each row in a table (e.g., the ID column).

  35. What is a foreign key?

    A column in one table that references the primary key of another table, creating a relationship.

Card 1 of 35
Card 1 of 35

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent