- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is MySQL CREATE command? How can we create both database and table with this command?
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;
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 ------------------------------);
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’.
- How to create a database on command line in MySQL?
- How can we establish MySQL database by using MySQL binary at command prompt?
- How can we add multiple columns, with single command, to an existing MySQL table?
- How can we create a table from an existing MySQL table in the database?
- How can we return to windows command shell from MySQL command line tool?
- How can we create our own choice MySQL database?
- How can we use WHERE clause with MySQL INSERT INTO command?
- Can we create a database with a numeric name with MySQL?
- How can we use MySQL ALTER TABLE command for adding comments on columns?
- After connecting to MySQL server how can we select a database from command prompt?
- MySQL command to copy table?
- How can we create user accounts in MySQL database server?
- How can we analyze the tables of a particular database from MySQL Server command line?
- How to generate a “create table” command based on an existing table in MySQL?
- What is stored procedure and how can we create MySQL stored procedures?