Post Details

Top 50 Interview SQL Commands
27 Aug

Top 50 Interview SQL Commands

1. SELECT - Retrieves data from a database
2. INSERT - Adds new records to a table
3. UPDATE - Modifies existing records in a table
4. DELETE - Removes records from a table
5. CREATE DATABASE - Creates a new database
6. CREATE TABLE - Creates a new table
7. DROP DATABASE - Deletes an entire database and its contents
8. DROP TABLE - Deletes a table
9. ALTER TABLE - Modifies an existing table structure
10. TRUNCATE TABLE - Removes all records from a table
11. CREATE INDEX - Creates an index on a table column to improve query performance
12. DROP INDEX - Removes an index from a table
13. INNER JOIN - Retrieves records that have matching values in both tables
14. LEFT JOIN - Retrieves all records from the left table and matching records from the right table
15. RIGHT JOIN - Retrieves all records from the right table and matching records from the left table
16. FULL OUTER JOIN - Retrieves all records when there is a match in either the left or right table
17. UNION - Combines the result sets of two or more SELECT statements
18. UNION ALL - Combines the result sets of two or more SELECT statements, including duplicates
19. DISTINCT - Retrieves unique values from a column
20. WHERE - Filters records based on specified conditions
21. ORDER BY Sorts the result set based on specified columns
22. GROUP BY- Groups the result set by one or more columns
23. HAVING - Filters groups based on specified conditions
24. COUNT - Returns the number of rows in a result set
25. SUM - Calculates the sum of values in a column
26. AVG - Calculates the average of values in a column
27. MIN - Retrieves the minimum value from a column
28. MAX - Retrieves the maximum value from a column
29. BETWEEN - Retrieves values within a specified range
30. LIKE - Searches for a specified pattern in a column
31. IN - Checks for values in a specified list
32. NOT - Negates a condition
33. IS NULL - Checks for NULL values
34. IS NOT NULL - Checks for non-NULL values
35. CASE - Performs conditional logic in SQL queries
36. COALESCE - Returns the first non-NULL value in a list
37. EXISTS - Checks for the existence of rows in a subquery result
38. ANY/SOME - Compares a value to a set of values returned by a subquery
39. ALL - Compares a value to all values returned by a subquery
40. JOIN  - Combines rows from two or more tables based on a related column
41. PRIMARY KEY - Defines a column or set of columns as the primary key for a table
42. FOREIGN KEY - Establishes a relationship between two tables
43. CONSTRAINT - Enforces rules on data in a table
44. INDEX - Improves the performance of SELECT queries by creating indexes on columns
45. TRANSACTION - Groups multiple SQL operations into a single unit of work
46. COMMIT - Saves changes made during a transaction
47. ROLLBACK - Reverts changes made during a transaction
48. SAVEPOINT - Marks a point within a transaction to which you can later roll back
49. GRANT - Provides privileges to database objects
50. REVOKE - Removes privileges from database objects

0 Comments

Leave a Comment