
π Late Night Chronicles: #5 Your First MySQL Commands π
Till now, we understood MySQL, SQL, and Data Types. Now itβs time to move from theory β practical. Letβs actually write some MySQL commands step by step π πΉ Create Database A database is simply a container that holds your tables and data. CREATE DATABASE company ; π This creates a new database named company. π Output: Query OK, 1 row affected πΉ Use Database Before performing any operations, we need to select the database we want to work with. USE company ; π This tells MySQL to use the company database for all upcoming operations. π Output: Database changed πΉ Create Table A table stores data in rows and columns. CREATE TABLE emp ( empno CHAR ( 4 ), ename VARCHAR ( 25 ), sal FLOAT , city VARCHAR ( 15 ), dob DATE ); π This creates a table emp with employee details π Output: Query OK, 0 rows affected πΉ Show Tables This command is used to check all tables in the current database. SHOW TABLES ; π This displays all tables inside the selected database. π Output: + ----------------+ | Tables_i
Continue reading on Dev.to
Opens in a new tab



