100 SQL Commands

100 SQL Commands

"Mastering SQL: 100 Essential Commands Every Database Developer Should Know"


Sure, here are 100 SQL commands:

  1. SELECT - Retrieve data from a database.
  2. INSERT - Insert new data into a database.
  3. UPDATE - Update existing data in a database.
  4. DELETE - Delete data from a database.
  5. CREATE DATABASE - Create a new database.
  6. CREATE TABLE - Create a new table in a database.
  7. ALTER TABLE - Modify an existing table structure.
  8. DROP TABLE - Delete a table from a database.
  9. TRUNCATE TABLE - Remove all records from a table.
  10. CREATE INDEX - Create an index on a table.
  11. DROP INDEX - Remove an index from a table.
  12. JOIN - Combine rows from two or more tables based on a related column.
  13. INNER JOIN - Return rows when there is at least one match in both tables.
  14. LEFT JOIN - Return all rows from the left table, and the matched rows from the right table.
  15. RIGHT JOIN - Return all rows from the right table and the matched rows from the left table.
  16. FULL OUTER JOIN - Return all rows when there is a match in one of the tables.
  17. UNION - Combine the results of two or more SELECT statements.
  18. UNION ALL - Combine the results of two or more SELECT statements, including duplicates.
  19. GROUP BY - Group rows that have the same values into summary rows.
  20. HAVING - Filter records based on a group condition.
  21. ORDER BY - Sort the result set in ascending or descending order.
  22. DISTINCT - Return only distinct (different) values.
  23. COUNT - Count the number of records in a result set.
  24. SUM - Calculate the sum of a set of values.
  25. AVG - Calculate the average value of a set of values.
  26. MIN - Find the minimum value in a set of values.
  27. MAX - Find the maximum value in a set of values.
  28. BETWEEN - Select values within a range.
  29. LIKE - Select values matching a pattern.
  30. IN - Specify multiple values in a WHERE clause.
  31. NOT IN - Specify values not in a list.
  32. EXISTS - Test for the existence of rows in a subquery.
  33. NOT EXISTS - Test for the non-existence of rows in a subquery.
  34. CASE - Perform conditional logic in a query.
  35. WHEN - Define conditions in a CASE statement.
  36. THEN - Specify the result when a condition is true in a CASE statement.
  37. ELSE - Specify the result when no conditions are true in a CASE statement.
  38. END - End a CASE statement.
  39. CAST - Convert a value from one data type to another.
  40. CONVERT - Convert a value from one data type to another.
  41. IS NULL - Test for null values.
  42. IS NOT NULL - Test for non-null values.
  43. COALESCE - Return the first non-null value in a list.
  44. NULLIF - Return null if two expressions are equal, otherwise return the first expression.
  45. TOP - Select the top N records from a result set.
  46. LIMIT - Limit the number of rows returned in a result set.
  47. OFFSET - Skip a specified number of rows in a result set.
  48. FETCH - Retrieve a specific number of rows from a result set.
  49. ROW_NUMBER() - Assign a unique sequential integer to each row in a result set.
  50. RANK() - Assign a rank to each row in a result set.
  51. DENSE_RANK() - Assign a dense rank to each row in a result set.
  52. NTILE() - Divide a result set into a specified number of equally sized groups.
  53. ROWS - Specify a window frame for analytic functions.
  54. PARTITION BY - Divide the result set into partitions for analytic functions.
  55. OVER - Specify the window for analytic functions.
  56. FIRST_VALUE() - Return the first value in a sorted partition of a result set.
  57. LAST_VALUE() - Return the last value in a sorted partition of a result set.
  58. LEAD() - Access data from a subsequent row in a result set.
  59. LAG() - Access data from a preceding row in a result set.
  60. CROSS APPLY - Apply a table-valued function to each row returned by a query.
  61. OUTER APPLY - Apply a table-valued function to each row returned by a query, including rows with no match.
  62. PIVOT - Rotate rows into columns based on the values in a specified column.
  63. UNPIVOT - Rotate columns into rows based on the values in a specified column.
  64. INDEX HINT - Specify an index to be used by the query optimizer.
  65. TRANSACTION - Start a transaction.
  66. COMMIT - Save the changes made in a transaction.
  67. ROLLBACK - Undo the changes made in a transaction.
  68. SAVEPOINT - Set a point within a transaction to which you can later roll back.
  69. DECLARE - Declare a variable.
  70. SET - Assign a value to a variable.
  71. DECLARE CURSOR - Declare a cursor for iterative processing of a result set.
  72. OPEN - Open a cursor.
  73. FETCH - Retrieve the next row from a cursor.
  74. CLOSE - Close a cursor.
  75. DEALLOCATE - Deallocate the memory associated with a cursor.
  76. CREATE VIEW - Create a virtual table based on the result of a SELECT statement.
  77. DROP VIEW - Delete a view from a database.
  78. GRANT - Grant permissions to a user or role.
  79. REVOKE - Revoke permissions from a user or role.
  80. CREATE USER - Create a new database user.
  81. DROP USER - Delete a database user.
  82. CREATE ROLE - Create a new role in a database.
  83. DROP ROLE - Delete a role from a database.
  84. BEGIN - Start a transaction block.
  85. END - End a transaction block.
  86. IF - Execute a set of SQL statements conditionally.
  87. ELSE - Specify an alternative set of SQL statements to execute.
  88. WHILE - Execute a set of SQL statements repeatedly while a condition is true.
  89. BREAK - Exit from a WHILE loop.
  90. CONTINUE - Skip the remaining statements in a loop iteration and start the next iteration.
  91. GOTO - Jump to a specified label within a batch or stored procedure.
  92. EXECUTE - Execute a stored procedure or dynamic SQL statement.
  93. CREATE PROCEDURE - Create a stored procedure.
  94. ALTER PROCEDURE - Modify an existing stored procedure.
  95. DROP PROCEDURE - Delete a stored procedure.
  96. CREATE FUNCTION - Create a user-defined function.
  97. ALTER FUNCTION - Modify an existing user-defined function.
  98. DROP FUNCTION - Delete a user-defined function.
  99. CREATE TRIGGER - Create a trigger that automatically executes in response to certain events.
  100. DROP TRIGGER - Delete a trigger from a database.

These commands cover a wide range of functionalities and operations that can be performed in SQL.

Reactions

Post a Comment

0 Comments

close