0% found this document useful (0 votes)
10 views

SQL Basic

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

SQL Basic

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

-------------SQL Database basic----------------

- order by _TIMESTAMP desc (lọc xem theo time update Z->A)


- create database NameDatabase
- use database NameDatabase
- create table NameTable
(
tag0 int,
tag1 varchar(50),
tag2 int,
tag3 varchar(50),
tag4 datetime,
tag5 int
)

- insert into dbo.NameTable


([tag0],tag1,[tag2],tag3,tag4,[tag5]) values (1, 'product_1',2221,111,2023-19-12,
4);

- select * (nhớ chọn đúng NameDatabase)


from NameTable

- select tag..., ..., (display colums values (muốn hiện mấy cột & cột gì))
from NameTable

- where tag1='product_2' (filter details)


and tag3 =112

- update NameTable
set _Value=212
where tag1='product_2'
and tag3 =112

- delete NameTable
where tag1='product_2'
and tag3=212

- alter table NameTable


add tag6 varchar(50);

- Getdate() hàm lấy real time

- alter table NameTable2


add foreign key (tb2tag1) references NameTable(tag00);

You might also like