Insert Records with SQL and Alter Table Statements

Опубликовано: 23 Март 2026
на канале: Data Science Man
4
0

Here are the queries used in this lesson

-- creating database and table without queries --

-- creating database and table with queries --

-- insert data without query --

-- insert data with query --

INSERT INTO `tbl_school` (`school_id`, `school_name`, `email`,

`website`, `address`, `phone`)

VALUES (NULL, 'XYZ School', '[email protected]',

'xyzexamplesxhool.com', '111, Exxmple Street, Delhi, India',

'+91-345'),

(NULL, 'UVW School', '[email protected]',

'www.uvwexamplesxhool.com', '', '+91-457');

-- Insert 1 Value with query --

-- name of `database`, `table`, `columns` in mysql

-- insert into tbl_name (col1, col2, col3 -- coln)

--INSERT INTO `categories` (`category_name`, `category_desc`) --

--VALUES ('Electronics','Electronics equipment like laptop, mobile, tv etc') --

INSERT INTO `categories` (`category_name`, `category_desc`)

VALUES ('Beverages','Hot and cold drinks'),('Books','Text books, good reads')

-- insert into tbl_name (col1, col2, col3) values('val1','val2','val3')

insert into customers(customer_name, customer_email, customer_phone)

values('monish', '[email protected]', '9953'),

('amit', '[email protected]', '9876'),

('mukul', '[email protected]', '9954')

INSERT INTO `customers`(`customer_name`, `customer_phone`, `customer_email`, `credit`)

VALUES ('vivek','1234','[email protected]',89)

ALTER TABLE `customers`

ADD `credit` FLOAT(5) NOT NULL DEFAULT '100'

AFTER `customer_email`;

--alter table tbl_name

--add newcol varchar(5) not null default 'good'

--after `customer_name`