SQL Basics: Creating, Changing and Querying Tables - CBSE Class 12 Computer Science Notes, Diagrams and Solved Questions

Write MySQL commands to create databases and tables, choose data types and constraints, change a table with ALTER, add, update and delete rows, and fetch exactly the rows you need with SELECT.

In this chapter

  • DDL and DML commands and how SQL statements are written
  • CHAR, VARCHAR, INT, FLOAT and DATE; NOT NULL, UNIQUE, PRIMARY KEY
  • CREATE, USE, SHOW, DESCRIBE and DROP
  • ALTER TABLE to add or remove columns and primary keys
  • INSERT, UPDATE and DELETE
  • SELECT with WHERE, operators, aliases and DISTINCT
  • IN, BETWEEN, IS NULL and LIKE patterns
  • Sorting results with ORDER BY