0% found this document useful (0 votes)
25 views

Mysql

This document outlines five MySQL commands: 1) CREATE DATABASE creates a new database; 2) DROP DATABASE deletes a database; 3) CREATE TABLE creates a new table with specified fields and data types; 4) SHOW DATABASES lists existing databases; and 5) SHOW TABLES lists existing tables in the current database. Examples are provided for each command.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Mysql

This document outlines five MySQL commands: 1) CREATE DATABASE creates a new database; 2) DROP DATABASE deletes a database; 3) CREATE TABLE creates a new table with specified fields and data types; 4) SHOW DATABASES lists existing databases; and 5) SHOW TABLES lists existing tables in the current database. Examples are provided for each command.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

A.

Creation of a database using mysql command


SYNTAX
CREATE DATABASE dbname;
PROGRAM
mysql> create database student;
B. Deletion of a database using mysql command
SYNTAX
DROP DATABASE dbname;
PROGRAM
mysql> DROP database student;
C. Creating of a table using mysql command
 Teacher_ID,
 First_Name,
 Last_Name,
 Gender,
 Salary,
 Date_of_Birth,
 Dept_No
PROGRAM
mysql> CREATE TABLE TEACHER
→(Teacher_ID INTEGER,
→First_Name VARCHAR(20),
→Last_Name VARCHAR(20),
→Gender CHAR(1),
→Salary DECIMAL(10,2)
→Date_of_Birth DATE,
→Dept_No INTEGER);
D. Show the databases and table created in
mysql
PROGRAM
mysql> show databases;

PROGRAM
mysql> show tables;
E. List out the field name along with itd field
type and constrainsts for a table
Teacher_ID, First_Name, Last_Name, Gender,
Salary, Date_of_Birth, Dept_No
PROGRAM
mysql> use school;
Database changed
mysql> desc teacher;

You might also like