Understand SQL DDL commands CREATE TABLE, ALTER TABLE and DROP TABLE with safe beginner examples.
DDL changes database structure. CREATE makes a table, ALTER adds or changes a column, and DROP removes the table. Practice in a test database before changing production objects.
Example
SELECT department, COUNT(*) AS student_count
FROM students
WHERE active = 1
GROUP BY department
ORDER BY student_count DESC;Try it yourself
- Create a small table with five rows.
- Run the example and change one clause.
- Explain the result in your own words.
Back to the SQL learning path · Reference topic map · Microsoft SQL documentation
No comments:
Post a Comment
Please do not enter any spam link in the comment box.