SlideShare a Scribd company logo
Table Creation using MYSQL Command
SQL> Create table employees (emp_id varchar2(10) NOT NULL, First_name
varchar2(10), Last_name varchar2(10), Email varchar2(30), Phone_no number(10), Job_id
varchar2(10), Manager_id varchar2(10), Dept_id varchar2(10));
Table created.
SQL> Create table jobs (job_id varchar2(10), Job_title varchar2(20), Min_salary
number(10,2));
Table created.
SQL>Create table manager (manager_id varchar2(10), Manager_name varchar2(20));
Table created.
Table Alter
SQL>Alter table employees add primary key(emp_id);
Table altered.
SQL>Alter table jobs add primary key(job_id);
Table altered.
SQL> Alter table employees add foreign key(job_id) references jobs(job_id);
Table altered.
Table Truncated.
SQL>Truncate table manager;
Table Dropped.
SQL>Drop table manager;
Table Insertion
SQL> Insert into jobs values(‘&job_id’,’&job_title’,’&min_salary’);
Enter the value for job_id: Tester_05
Ener the value for job_title: Software Tester
Enter the value for min_salary: 25000
Old 1: > Insert into jobs values(‘&job_id’,’&job_title’,’&min_salary’);
New 1: > Insert into jobs values (‘Tester_05’,’ Software Tester ’,’ 25000’);
1 row created
SQL>update jobs set min_salary=’45000’ where job_id=’dev_02’;
1row updated.
SQL>Delete from jobs where job_title=’Software Tester’;
1 row deleted.
SQL> Insert into employees values (‘&emp_id’,’&first_name’,’&last_name’,’&email’,
’&phone_no’,‘&job_id’,’&manager_id’’&dept_id’);
Enter the value for emp_id: 00A1
Enter the value for first_name: karthik
Enter the value for last_name: Krishna
Enter the value for email: kkk@gmail.com
Enter the value for phone_no:9876543210
Enter the value for job_id:
Enter the value for manager_id:
Enter the value for dept_id:
Old 1: > Insert into employees values (‘&emp_id’,’&first_name’,’&last_name’,’&email’,
’&phone_no’,‘&job_id’,’&manager_id’’&dept_id’);
New 1: > > Insert into employees values
(‘00A1’,’karthik’,’krishna’,’kkk@gmail.com’,’9876543210’,’ ‘,’ ‘,’ ‘);
Table Selection
SQL> select *from jobs;
JOB_ID JOB_TITLE MIN_SALARY
--------------- -------------------- ----------------------
dev_02 Developer 45000
Tester_05 Software Tester 25000
SQL> select *from employees;
EMP_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER
---------- ---------- --------- ---------------------- ------------
000A1 karthik krishna kkk@gmail.com 9807654321
JOB_ID MANAGER_ID DEPARTMENT_ID
--------------- --------------- ---------------
SQL>select constraint_name from user_constraints where table_name=’EMPLOYEES’;
CONSTRAINT_NAME
---------------------
SYS_C006990
SYS_C006994
SQL>select last_name from employees where last_name like’k%’;
LAST NAME
-----------
Krishna
SQL> select*from jobs where min_salary between(30000) and (50000);
JOB_ID JOB_TITLE MIN_SALARY
---------- --------------- -----------------
Dev_02 Developer 45000

More Related Content

PPT
Sqlbysandeep
PDF
Sql commands
PPTX
SQL - DML and DDL Commands
PPTX
DDL POSTGRESQLlllllllllllllllllllllllllllllllll
PPTX
DDL POSTGRESQLlllllllllllllllll (1).pptx
PDF
sql language
PPT
Sqlbysandeep
Sql commands
SQL - DML and DDL Commands
DDL POSTGRESQLlllllllllllllllllllllllllllllllll
DDL POSTGRESQLlllllllllllllllll (1).pptx
sql language

Similar to Database Manipulation with MYSQL Commands (19)

PPT
MySql slides (ppt)
PPTX
DOODB_LAB.pptx
PPT
PPT
Les09 (using ddl statements to create and manage tables)
PPT
mysqlHiep.ppt
PPT
MySQL Database System Hiep Dinh
PPTX
SQL Sort Notes
PPTX
Commands
PDF
Using Perl Stored Procedures for MariaDB
DOCX
Parallel Server
PPTX
Lecture 3 sql {basics ddl commands}
PDF
SQL Quick Reference Card
PDF
Learn plsql
PPTX
SQL DATABASE MANAGAEMENT SYSTEM FOR CLASS 12 CBSE
DOCX
Contraints
PPT
CreacióN Tablas En Oracle
DOC
Database management system file
MySql slides (ppt)
DOODB_LAB.pptx
Les09 (using ddl statements to create and manage tables)
mysqlHiep.ppt
MySQL Database System Hiep Dinh
SQL Sort Notes
Commands
Using Perl Stored Procedures for MariaDB
Parallel Server
Lecture 3 sql {basics ddl commands}
SQL Quick Reference Card
Learn plsql
SQL DATABASE MANAGAEMENT SYSTEM FOR CLASS 12 CBSE
Contraints
CreacióN Tablas En Oracle
Database management system file
Ad

More from Pyingkodi Maran (20)

PDF
Defining Identity as a Service (IDaaS) in Cloud Computing
PDF
Data Science Normal Distribution Z-Score
PDF
Data Science Introduction and Process in Data Science
PDF
Jquery Tutorials for designing Dynamic Web Site
PDF
Working with AWS Relational Database Instances
DOC
Health Monitoring System using IoT.doc
PPT
IoT Industry Adaptation of AI.ppt
PPT
IoT_Testing.ppt
PDF
Azure Devops
PDF
Creation of Web Portal using DURPAL
PDF
AWS Relational Database Instance
PDF
AWS S3 Buckets
PDF
Creation of AWS Instance in Cloud Platform
PDF
Amazon Web Service.pdf
PDF
Cloud Security
PDF
Cloud Computing Introduction
PDF
Supervised Machine Learning Algorithm
PDF
Unsupervised Learning in Machine Learning
PDF
Feature Engineering in Machine Learning
PDF
Normalization in DBMS
Defining Identity as a Service (IDaaS) in Cloud Computing
Data Science Normal Distribution Z-Score
Data Science Introduction and Process in Data Science
Jquery Tutorials for designing Dynamic Web Site
Working with AWS Relational Database Instances
Health Monitoring System using IoT.doc
IoT Industry Adaptation of AI.ppt
IoT_Testing.ppt
Azure Devops
Creation of Web Portal using DURPAL
AWS Relational Database Instance
AWS S3 Buckets
Creation of AWS Instance in Cloud Platform
Amazon Web Service.pdf
Cloud Security
Cloud Computing Introduction
Supervised Machine Learning Algorithm
Unsupervised Learning in Machine Learning
Feature Engineering in Machine Learning
Normalization in DBMS
Ad

Recently uploaded (20)

PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
web development for engineering and engineering
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
Sustainable Sites - Green Building Construction
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
Welding lecture in detail for understanding
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
UNIT 4 Total Quality Management .pptx
PDF
Arduino robotics embedded978-1-4302-3184-4.pdf
PPTX
Geodesy 1.pptx...............................................
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPT
Project quality management in manufacturing
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
CH1 Production IntroductoryConcepts.pptx
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
web development for engineering and engineering
Model Code of Practice - Construction Work - 21102022 .pdf
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Sustainable Sites - Green Building Construction
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Welding lecture in detail for understanding
Operating System & Kernel Study Guide-1 - converted.pdf
UNIT 4 Total Quality Management .pptx
Arduino robotics embedded978-1-4302-3184-4.pdf
Geodesy 1.pptx...............................................
Internet of Things (IOT) - A guide to understanding
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Project quality management in manufacturing
Embodied AI: Ushering in the Next Era of Intelligent Systems
CH1 Production IntroductoryConcepts.pptx

Database Manipulation with MYSQL Commands

  • 1. Table Creation using MYSQL Command SQL> Create table employees (emp_id varchar2(10) NOT NULL, First_name varchar2(10), Last_name varchar2(10), Email varchar2(30), Phone_no number(10), Job_id varchar2(10), Manager_id varchar2(10), Dept_id varchar2(10)); Table created. SQL> Create table jobs (job_id varchar2(10), Job_title varchar2(20), Min_salary number(10,2)); Table created. SQL>Create table manager (manager_id varchar2(10), Manager_name varchar2(20)); Table created. Table Alter SQL>Alter table employees add primary key(emp_id); Table altered. SQL>Alter table jobs add primary key(job_id); Table altered. SQL> Alter table employees add foreign key(job_id) references jobs(job_id); Table altered. Table Truncated. SQL>Truncate table manager; Table Dropped. SQL>Drop table manager;
  • 2. Table Insertion SQL> Insert into jobs values(‘&job_id’,’&job_title’,’&min_salary’); Enter the value for job_id: Tester_05 Ener the value for job_title: Software Tester Enter the value for min_salary: 25000 Old 1: > Insert into jobs values(‘&job_id’,’&job_title’,’&min_salary’); New 1: > Insert into jobs values (‘Tester_05’,’ Software Tester ’,’ 25000’); 1 row created SQL>update jobs set min_salary=’45000’ where job_id=’dev_02’; 1row updated. SQL>Delete from jobs where job_title=’Software Tester’; 1 row deleted. SQL> Insert into employees values (‘&emp_id’,’&first_name’,’&last_name’,’&email’, ’&phone_no’,‘&job_id’,’&manager_id’’&dept_id’); Enter the value for emp_id: 00A1 Enter the value for first_name: karthik Enter the value for last_name: Krishna Enter the value for email: kkk@gmail.com Enter the value for phone_no:9876543210 Enter the value for job_id: Enter the value for manager_id: Enter the value for dept_id:
  • 3. Old 1: > Insert into employees values (‘&emp_id’,’&first_name’,’&last_name’,’&email’, ’&phone_no’,‘&job_id’,’&manager_id’’&dept_id’); New 1: > > Insert into employees values (‘00A1’,’karthik’,’krishna’,’kkk@gmail.com’,’9876543210’,’ ‘,’ ‘,’ ‘); Table Selection SQL> select *from jobs; JOB_ID JOB_TITLE MIN_SALARY --------------- -------------------- ---------------------- dev_02 Developer 45000 Tester_05 Software Tester 25000 SQL> select *from employees; EMP_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER ---------- ---------- --------- ---------------------- ------------ 000A1 karthik krishna kkk@gmail.com 9807654321 JOB_ID MANAGER_ID DEPARTMENT_ID --------------- --------------- --------------- SQL>select constraint_name from user_constraints where table_name=’EMPLOYEES’; CONSTRAINT_NAME --------------------- SYS_C006990 SYS_C006994 SQL>select last_name from employees where last_name like’k%’; LAST NAME -----------
  • 4. Krishna SQL> select*from jobs where min_salary between(30000) and (50000); JOB_ID JOB_TITLE MIN_SALARY ---------- --------------- ----------------- Dev_02 Developer 45000