SQL Queries

Insert data:

insert into TabelName (`Var1`, `Var2`, `Var2`) values ('Content1','Content2','Content2');

Delete data:
delete from TabelName where Var1='Content1';

Update data:
update Tabelname set Var1='More Content' where Var1='Content1';

Queries:
select * from Tablename;
  Show all rows from Tablename

select * from Tablename where Var1='Content';
  Show all rows from Tablename where Var1 contais "Content"

select Var1,Var2 from Tablename where ID<20;
  Show Var1 and Var2 from Tablename with ID lower than 20

select distinct Var1 from TabelName 
  Show all values of Var1 from tablenames except clones

select title from content  where title like "%crac%" and type="dictionary";
   Show all values of content where title containts the letter 'crac' and type is 'dictionary'
Dette indlæg blev udgivet i Knowledge Base. Bogmærk permalinket.

Skriv et svar