The document provides an overview of data, types of data, and the structure of databases, including concepts like rows, columns, and tables. It details commands for managing databases and tables in RDBMS systems such as Oracle and MySQL, including creating, describing, and querying tables. Additionally, it includes examples of SQL commands for inserting and manipulating data within a table.
Download as TXT, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
7 views
Day 2 - SQL Commands
The document provides an overview of data, types of data, and the structure of databases, including concepts like rows, columns, and tables. It details commands for managing databases and tables in RDBMS systems such as Oracle and MySQL, including creating, describing, and querying tables. Additionally, it includes examples of SQL commands for inserting and manipulating data within a table.
______________________________________________________________________________ To see the list of Databases present on the Server - SHOW DATABASES; To create a Database - CREATE DATABASE database_name; To clear the screen - \! cls To connect to a database in the server - USE database_name; To create a table: CREATE TABLE table_name( structure ); To see the Structure of the table - DESCRIBE table_name; or DESC table_name; To Drop a Table - DROP TABLE table_name; To Query/see the data in the table - SELECT * FROM table_name; To Delete Data from the table - DELETE FROM table_name;
INSERT INTO employee VALUES('Raja','Ram','Roy',32,35000,'Hyderabad'); INSERT INTO employee(first_name,last_name,age,salary,location) VALUES('Mohan','Roy',28,35000,'Hyderabad');
CREATE TABLE employee(
first_name varchar(20) NOT NULL, mid_name varchar(20), last_name varchar(20) NOT NULL, age int NOT NULL, salary int NOT NULL, location varchar(20) DEFAULT 'Hyderbad' NOT NULL );
INSERT INTO employee(first_name,last_name,age,salary)
VALUES('Mohan','Roy',28,35000);
insert into employee(first_name,mid_name,last_name,age,salary,location)
values('Steve',null,"Mc'Donald",50,750000,'Chennai'); insert into employee(first_name,mid_name,last_name,age,salary,location) values('Steve',null,'Mc\'Donald',50,750000,'Chennai');
Bulk Insert - INSERT INTO employee(first_name,last_name,age,salary) VALUES('Mohan','Roy',28,35000),('Raja','Ram',25,25000);