
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
MySQL CREATE Command: Create Database and Table
CREATE command is a DDL command which is used to create a table or a database. The syntax for creating table and database with CREATE command is as follows −
The syntax for creating a database −
Create database database-name;
Example
mysql> Create database query; Query OK, 1 row affected (0.04 sec)
In the example above we have created a database named ‘query’.
The syntax for creating a table −
Create table table-name( column-name1 datatype1, column-name2 datatype2, column-name3 datatype3, column-name4 datatype4 ------------------------------);
Example
mysql> Create table Employee(Id INT, Name Varchar(20)); Query OK, 0 rows affected (0.19 sec)
In the example above, we have created a table named ‘Employee’ having two columns ‘Id’ and ‘Name’.
Advertisements