Insert Update Delete Query in SQL – SQL CRUD Query

Insert Update Delete Query in SQL – SQL CRUD Query

Simple INSERT INTO statements in mysql are commonly all of the referred to as append simple sql queries. To add one or more record to a table add and create, you must use the all the field list to define which one or more fields to put the simple data in, and then you create must supply the data itself data in a value list data. To define any the value list all of the data types, use the SQL VALUES clause.

MySQL What is DDL, DML and DCL?

DML

SELECT
UPDATE
DELETE
INSERT into

DDL

Create Database
Alter Database
Create table
Alter table
Drop table
create/Drop Index

Data Manipulation: SELECT

Select * from table_name

Data Manipulation: Distinct

select DISTICT city From Person

Where

Select * from students where city=’rajkot’

=,<>,<,>,Like,IN,Between

SQL AND OR Condition

select * from web where fname=”live” AND age=25
select * from web where fname=”live” OR age=25

ORDER BY

select * from live24u ORDER BY LASTNAME DESC
DESC/AESC

Data Manipulation: INSERT

INSERT into stud (ct_id,lastname,fname) VALUES (6,”live”,”dsppatel”)

Data Manipulation: UPDATE

UPDATE webmst SET address=’rajkot’,name=’dsp’ where age=”25″ AND lname=”kam”

Data Manipulation: DELETE

DELETE FROM stud where id=100

TOP

select * from students where rownum <=5 select top 2 * from students select top 50 PERCENT * from students select * from students LIMIT 5

Like

select * from stud where city Like ‘s%’
select * from stud where city Like ‘%st%’
select * from stud where city Like ‘%s’

Not Like

select * from stud where city NOT Like ‘s%’
select * from stud where city NOT Like ‘%st%’
select * from stud where city NOT Like ‘%s’

Wield_cards

Like ‘__la’
Like ‘s_ad_nf’
Like ‘[dsp]%’

IN

select * from stude where sid IN(1,2,3,4,5)
select * from stude where sid ALL IN(5)

BETWEEN

select * from stude where lanme BETWEEN “jay” AND “ram”
select * from post where id BETWEEN 10 AND 80

Example

Leave a Comment