zoukankan      html  css  js  c++  java
  • 数据库编程

    结构化查询语言SQL
        1.创建表格
        create table tablename 
        (column1 datatype [constraint],
            column2 datatype [constraint], 
            column3 datatype [constraint]); 
        例
        create table employee 
        (firstname varchar(15), 
               lastname varchar(20), 
               age int,
               address varchar(30), 
               city varchar(20));
        2 删除数据库表格——注意,这里不要胡记成"delete",那么,为什么delete不用呢,原来,其被用到了删除数据
        drop table tablename 
        例
        drop table employee;
        3 数据查询
        select column1 [, column2,etc] from tablename 
        [where condition]; 
         [order by counmn1[ASC|DESC] [,order by   column2[ASC|DESC]]] 
        例如:
        1)select * from employee; 
        2)select firstname,lastname from employee; 
        3)select firstname,lastname from employee where age>30;
        4 向表中插入数据
        insert into tablename 
        (first_column,...last_column) 
        values (first_value,...last_value);
        例如: 
        insert into employee 
        (firstname, lastname, age, address, city)
        values (‘Wu’, ‘Jun’, 20, ‘No.11 Beijing Road’, ‘Wuhan’);
        5 更新数据
        update tablename 
        set columnname = newvalue [, nextcolumn = newvalue2...] 
        where columnname OPERATOR value [and|or column OPERATOR value];
        例如: 
        update employee 
        set age = age+10 
        where firstname= ‘Li’and lastname= ‘Ming’;
        6 删除数据
        delete from tablename 
        where columnname OPERATOR value [and|or column OPERATOR value];
        例如: 
        delete from employee 
        where firstname=‘Wu’ and lastname = ‘Jun’; 

  • 相关阅读:
    WINDOWS API ——GETFILETIME——获取文件时间
    lua 源码分析之线程对象lua_State
    GPL、BSD、MIT、Mozilla、Apache、LGPL开源协议介绍
    BOOST 线程完全攻略
    宏定义中#和##符号的使用和宏定义展开问题
    weak_ptr<T>智能指针
    轻松记住大端小端的含义(附对大端和小端的解释)
    关于VC预定义常量_WIN32,WIN32,_WIN64
    VC 预定义宏
    php技术之路
  • 原文地址:https://www.cnblogs.com/houziqizhu/p/6854126.html
Copyright © 2011-2022 走看看