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

Create Table SQL

Python sql create table commands
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Create Table SQL

Python sql create table commands
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Mysql

Structured query language


Learning Objecti ves
SQL commands are divided into different categories:
DDL, DML, and DCL.

CREATE command is used to create databases and tables.


Introducti on
SQL stands for Structured Query Language. It is used
for storing and managing data in relational database
management system (RDMS). It is a standard
language for Relational Database System. It enables a
user to create, read, update and delete relational
databases and tables.
PREVIOUS LEARNING
In an RDBMS data is stored in tables.

A table refers to a two dimensional representation of data arranged


in columns and rows.

SQL (Structured Query Language) is used to manage databases in an


RDBMS.
STARTER ACTIVITY

Which column can be declared primary key of the table?


Which column can be declared candidate keys of the table?
What will be the data type for each column of the table?
Create Database
CREATE DATABASE ADIS;

Creates a database with the specified name.

USE ADIS;

Opens the specified database for use.


Create Command
SYNTAX:-

CREATE TABLE <tablename>


(<column name1> <data type1>
[,<column name2> <data type2>,
. .

<column nameN> <data typeN>] );

Creates a table with the specified name.


Create Command
SYNTAX:- DDL Command

CREATE TABLE <tablename>


(<column name1> <data type1>
[,<column name2> <data type2>,
. .

<column nameN> <data typeN>] );

Creates a table with the specified name.


Constraints

5 CHECK The CHECK constraint specifies a search condition


to check the value being entered into a row.
6 DEFAULT The DEFAULT constraint is used to provide a default
value for a column.
INSERT
Command:
INSERT DML Command
Syntax:
INSERT INTO <tablename>
[<column1>, <column2>, ..., <columnn>]
VALUES (<value1>, <value2>, ... <value n>);

Purpose: Inserts data into a table


Command: DESCRIBE DML
Syntax:
DESC[RIBE] <tablename>;

Purpose: Shows the structure of a table.

Command: SHOW TABLES DML


Syntax:
SHOW TABLES;

Purpose: Shows a list of tables present in the


current database.
MAIN ACTIVITY
MAIN ACTIVITY
1.Create the database LOANS.
2.Use the database LOANS.
3.Create the table
Loan_Accounts.
4.Insert tuples in it.
PLENARY
1. In an RDBMS data is stored in tables.
2. A table refers to a two dimensional
representation of data arranged in columns and
rows.
3. SQL (Structured Query Language) is used to
manage databases in an RDBMS.
4. SQL commands are divided into different
categories: DDL, DML, and DCL.
5. CREATE command is used to create databases
and tables.
HOME WORK
Write commands to create Student Table and insert records to
it.

You might also like