How to Create Database and tables in MySql

How to Create Database and tables in MySql

In this article will explain How to Create Database and tables in MySql.

Create a Database

CREATE DATABASE DATABASE_NAME;

In MySql, if you want to display a list of all databases to run the below query.

SHOW DATABASES;

Create Tables:

To create a table in MySQL run below query.

CREATE TABLE IF NOT EXISTS table_name(col type, col type)

Example:

CREATE TABLE IF NOT EXISTS student (
  id int(5) NOT NULL,
  name text(8) NOT NULL,
  rollno int(10) NOT NULL
);

How to Insert Data into Mysql Database using PHP

Read on Facebook

1 Comment

  • Elizbeth

    September 11, 2020 - 7:02 pm

    It’s very effortless to find out any topic on web as compared to books, as I found this paragraph at this web page.

Leave A Reply