In this tutorial we're going to learn how to use where condition insert and update and delete query. using below command i have to create teacher table and course table and course having teacher foreign key.
**********************************************
create table using running below command
CREATE TABLE teacher (
id INT PRIMARY KEY,
teacher_name VARCHAR(100),
teacher_contact VARCHAR(50),
learning_mode VARCHAR(50)
);
This use for foreign key in course table
CREATE TABLE course (
course_id INT PRIMARY KEY,
course_title VARCHAR(100),
teacher_id INT,
course_price DECIMAL(10, 2),
FOREIGN KEY (teacher_id) REFERENCES teacher(id)
);
using below command for insert the data in teacher table
INSERT INTO teacher (id, teacher_name, teacher_contact, learning_mode) VALUES
(1, 'Amit Kumar', '7256824053', 'Online'),
(2, 'Priya Singh', '9891567823', 'In-person'),
(3, 'Rohan Sharma', '9786453124', 'Hybrid'),
(4, 'Neha Verma', '9123456780', 'Online'),
(5, 'Arjun Mehta', '9865321478', 'In-person'),
(6, 'Sana Khan', '9988776655', 'Hybrid'),
(7, 'Vikram Joshi', '9876543210', 'Online'),
(8, 'Anjali Patel', '9123456700', 'In-person'),
(9, 'Karan Kapoor', '9812345678', 'Hybrid'),
(10, 'Rina Das', '9098765432', 'Online'),
(11, 'Sahil Bhatia', '9123456789', 'In-person'),
(12, 'Lata Menon', '9810987654', 'Hybrid'),
(13, 'Mohan Reddy', '9001234567', 'Online'),
(14, 'Suman Aggarwal', '9876541230', 'In-person'),
(15, 'Devika Nair', '9898076543', 'Hybrid'),
(16, 'Rahul Gupta', '9988765432', 'Online'),
(17, 'Isha Roy', '9112345678', 'In-person'),
(18, 'Naveen Chawla', '9123456781', 'Hybrid'),
(19, 'Tina Bose', '9900987654', 'Online'),
(20, 'Aman Malik', '9876512340', 'In-person'),
(21, 'Pooja Bhatt', '9887766554', 'Hybrid');
using below command for insert the data in course table
INSERT INTO course (course_id, course_title, teacher_id, course_price) VALUES
(1, 'AWS 101', 1, 200.00),
(2, 'Docker Basics', 2, 15000.00),
(3, 'Ansible Essentials', 3, 12000.00),
(4, 'Kubernetes for Beginners', 4, 180.00),
(5, 'Git and GitHub', 5, 10000.00),
(6, 'Python Programming', 6, 17000.00),
(7, 'Laravel Framework', 7, 16000.00),
(8, 'DevOps Fundamentals', 8, 14000.00),
(9, 'Data Science with Python', 9, 21000.00),
(10, 'Machine Learning Basics', 10, 22000.00),
(11, 'React Development', 11, 18000.00),
(12, 'Node.js Essentials', 12, 15000.00),
(13, 'Angular Development', 13, 20000.00),
(14, 'Java Programming', 14, 19000.00),
(15, 'C++ Programming', 15, 17000.00),
(16, 'Ruby on Rails', 16, 16000.00),
(17, 'SQL Database', 17, 13000.00),
(18, 'NoSQL Database', 18, 14000.00),
(19, 'Blockchain Basics', 19, 25000.00),
(20, 'Cyber Security Essentials', 20, 24000.00),
(21, 'Cloud Computing', 21, 23000.00);
8 июн 2024