ASP¿Í DB¿ÍÀÇ ¿¬µ¿½Ã »ç¿ëµÇ´Â SQL ÁúÀǹ®ÀÇ ±âº»ÀûÀÎ »ç¿ë¹æ¹ýÀÔ´Ï´Ù.
Å×À̺í À̸§ : members
Ä÷·³¸í : name, email, age , tel
³»¿ë :
name |
email |
age |
tel |
µ¿ÅÂÁö |
a@korea.com |
10 |
123-123 |
¼ÅÂÁö |
b@korea.com |
20 |
123-456 |
³²ÅÂÁö |
c@korea.com |
30 |
123-789 |
ºÏÅÂÁö |
d@korea.com |
40 |
123-012 |
|
select ¹®
1. members ¿¡ ÀÖ´Â ¸ðµç ³»¿ëÀ» ºÒ·¯¿À±â.
2. À̸§ÀÌ µ¿ÅÂÁö À̶ó´Â Á¤º¸¸¦ ºÒ·¯¿À±â.
Select userid, name, email, age from
Members where name="µ¿ÅÂÁö" |
3. À̸§ÀÌ ¼ÅÂÁöÀÎ »ç¶÷ÀÇ ³ªÀ̸¦ ºÒ·¯¿À±â.
Select age from Members where name="¼ÅÂÁö"
|
4. À̸§ÀÌ ³²ÅÂÁö, ³ªÀÌ°¡ 27ÀÎ »ç¶÷ÀÇ ¸ðµç Á¤º¸ ºÒ·¯¿À±â
Select * From Members Where userid="rainny2"
and age="27" |
5. email Áß 'c' °¡ µé¾î °¡´Â »ç¶÷ÀÇ À̸§À» ºÒ·¯¿À±â.
Select name from Members where email
like '%k%' |
insert ¹®
Inser into Å×À̺í (Ä÷·³À̸§, .... ) values ('³»¿ë', .......... )
À̸§: È«±æµ¿, À̸ÞÀÏ: e@korea.com, ³ªÀÌ: 40, tel :123-234 ·¹ÄÚµå »ðÀÔ
Insert into members (name,email,age,tel)
values ('È«±æµ¿','e@korea.com',15,'123-456') |
Update ¹®
Update Å×À̺í set Ä÷·³ = ³»¿ë , ... where Á¶°Ç¹®
ex) À̸§ÀÌ µ¿ÅÂÁöÀÎ »ç¶÷ÀÇ ³ªÀ̸¦ 20»ì·Î À̸ÞÀÏÀ» abc@korea.com À¸·Î ¼öÁ¤ÇÏ´Â ¹æ¹ý
Update members set age='20', email='abc@korea.com'
where name="µ¿ÅÂÁö" |
Delete ¹®
Delete from Å×À̺í Á¶°Ç¹®
ex) ³ªÀÌ°¡ 20»ìÀÎ »ç¶÷À» »èÁ¦Çضó.
Delete from Members Where age = "20" |
|
|