Back to articles
πŸŒ™ Late Night Chronicles: #5 Your First MySQL Commands πŸš€
How-ToSystems

πŸŒ™ Late Night Chronicles: #5 Your First MySQL Commands πŸš€

via Dev.toShreyash Ogale

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

Read Full Article
2 views

Related Articles