SQL Flashcards

The SQL Interview Flashcards present key SQL topics, aiding users in quick recall, deeper understanding, and effective preparation for interviews or assessments. This resource facilitates efficient review and reinforcement of key SQL topics, fostering enhanced understanding, retention, and confidence for interview scenarios or practical application.
  • To-Do
    75 Flashcards
  • Done
    0 Flashcards
  • Start Over
    Reset All Flashcards
Flashcard
What is the output of the following query?
SELECT 25%5
Show Answer

0
Flashcard

What data type in PostgreSQL is used for auto-incrementing columns?

Show Answer

SERIAL or BIGSERIAL
Flashcard
What is a Cartesian product in SQL?
Show Answer

The result set that contains all ordered pairs of rows (x, y) for which x belongs to Table1 and y belongs to Table2

SELECT a.*, b.*
FROM table_name a, table_name b;
Flashcard

What is the purpose of EXPLAIN ANALYZE?

Show Answer

Provides a query execution plan and actual runtime statistics.
Flashcard

How do you identify duplicate rows in a table?

Show Answer

Use GROUP BY col1, col2 HAVING COUNT(*) > 1
Flashcard

What does the COALESCE function do?

Show Answer

Returns the first non-NULL value from its arguments.
Flashcard
What Function Would You Use To Replace one string with a Different string In PostgreSQL?
Show Answer

REPLACE()
Flashcard
What function would you use to replace a character in a string with a different character in PostgreSQL?
Show Answer

TRANSLATE()
Flashcard
You would use the UNION ALL operator if you wanted to do what?
Show Answer

Combine two or more result sets without eliminating duplicate rows.
Flashcard
What does the UNION clause do?
Show Answer

Combine two or more result sets while eliminating duplicate rows.
Flashcard
What is the EXCEPT clause used for?
Show Answer

Returns those records from one SELECT query, that are not present in the results returned by the second SELECT query.

SELECT * FROM Table1
EXCEPT
SELECT * FROM Table2;
Flashcard
What is the largest numeric value that can be stored in a column with a BYTE datatype?
Show Answer

255
Flashcard
Can you update a VIEW in PostgreSQL?
Show Answer

No
Flashcard
What does the ACID acronym refer to?
Show Answer

ACID refers to the four key properties of a SQL transaction: atomicity, consistency, isolation, and durability.
Flashcard
What Is the Order of Execution of an SQL Query?
Show Answer

1st - FROM
2nd - ON
3rd - OUTER
4th - WHERE
5th - GROUP BY
6th - HAVING
7th - SELECT
8th - DISTINCT
9th - ORDER BY
10th - TOP
Flashcard
What is the output of the following query?
SELECT FLOOR(6.826)
Show Answer

6
Flashcard

What Is the Difference Between the WHERE and HAVING Clauses in SQL?

Show Answer

The WHERE Clause is used to filter the records of a table based on a specific condition. The HAVING Clause is used to filter the records resulting from an aggregate function query. HAVING clause is used to filter the record from the groups based on the specified condition.

Flashcard
How do you add comments to a SQL query?
Show Answer

-- This is a single line comment

/*
This is a
multiline comment
*/
Flashcard

How do you store semi-structured data in PostgreSQL?

Show Answer

Use the JSON or JSONB data types.
Flashcard
What is the difference between the DROP and TRUNCATE clauses in SQL?
Show Answer

The DROP clause is used to drop an existing table in a database.

The TRUNCATE clause is used to delete the data inside an existing table, but not the table itself.