Oracle Database is a comprehensive and robust relational database management system (RDBMS) widely used for enterprise-level applications. This cheat sheet presents essential commands and queries to interact efficiently with Oracle databases.
INSERT INTO [table_name] VALUES (value1, value2, ...);
Insert data into a table.
INSERT INTO [table_name] (column1, column2, ...) VALUES (value1, value2, ...);
Insert data with specified columns.
Querying Data:
Command
Description
SELECT * FROM [table_name];
Retrieve all columns from a table.
SELECT column1, column2 FROM [table_name] WHERE condition;
Retrieve specific columns with conditions.
UPDATE [table_name] SET column1 = value1 WHERE condition;
Update data in a table.
DELETE FROM [table_name] WHERE condition;
Delete data from a table.
Filtering and Sorting:
Command
Description
SELECT * FROM [table_name] WHERE condition ORDER BY column_name ASC/DESC;
Filter and sort query results.
FETCH FIRST [number] ROWS ONLY;
Limit the number of rows returned.
Aggregation Functions:
Command
Description
SELECT COUNT(column_name) FROM [table_name];
Count the number of rows in a table.
SELECT AVG(column_name) FROM [table_name];
Calculate the average value of a column.
SELECT MAX(column_name) FROM [table_name];
Retrieve the maximum value in a column.
SELECT MIN(column_name) FROM [table_name];
Retrieve the minimum value in a column.
SELECT SUM(column_name) FROM [table_name];
Calculate the sum of values in a column.
Conclusion
This Oracle Database cheat sheet serves as a valuable resource for Oracle users, providing essential commands for database management, table creation, data manipulation, and querying. Oracle’s feature-rich capabilities make it a preferred choice for enterprise-level applications. Adapt these commands to your specific Oracle environment and database requirements.