SQL

时间:2014-07-16 18:14:10   收藏:0   阅读:266

1.总起来就四个字CURD C=create U=update R=read D=delete

对应语句就是insert into | update | select | delete 

2.注意防止sql injection

txtNam = getRequestString("CustomerName");
txtAdd = getRequestString("Address");
txtCit = getRequestString("City");
txtSQL = "INSERT INTO Customers (CustomerName,Address,City) Values(@0,@1,@2)";
db.Execute(txtSQL,txtNam,txtAdd,txtCit);

这方法叫做参数化sql语句,先建立一个sql语句的样式pattern,可变部分作为参数传入。

3.第一次了解了foreign key 的用法

select customers.customerid,orders.orderdate,customers.city,customer.country

from customers inner join orders on customers.customerid=orders.customerid where customers.city=‘london‘ and orders.orderid <77

inner 所得的结果是join

SQL,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!