DBMS SQL Commands With Examples
DBMS SQL Commands With Examples
name VARCHAR(50),
age INT
);
-- ALTER
-- DROP
-- TRUNCATE
-- RENAME
INSERT INTO students (id, name, age) VALUES (1, 'Rahul', 20);
-- SELECT
-- UPDATE
-- DELETE
START TRANSACTION;
-- COMMIT
COMMIT;
-- ROLLBACK
ROLLBACK;
-- SAVEPOINT
SAVEPOINT my_savepoint;
-- ROLLBACK TO SAVEPOINT
ROLLBACK TO my_savepoint;
-- REVOKE
DESC students;
-- SHOW TABLES
SHOW TABLES;
-- USE
USE my_database;
-- CREATE INDEX
-- DROP INDEX
DROP INDEX idx_name ON students;
-- GROUP BY
-- ORDER BY
-- WHERE
-- HAVING
SELECT age, COUNT(*) FROM students GROUP BY age HAVING COUNT(*) > 1;
-- JOIN
FROM students s