zoukankan      html  css  js  c++  java
  • 数据库操作相关(sql语句-命令行)

    创建数据库:
    create database books;
    创建用户:
    mysql> grant select,insert,delete,uptate
        -> on books.*
        -> to dada identified by 'yujianqi2011';
     
    使用数据库:
    use dbname;
    use dada;
     
    新建数据库表
    create table tablename(columns);
    create table demo(
         userid int unsigned not null auto_increment primary key,
         username char(50) not null,
         password char(20) not null,
         age int not null,
         city char(20) not null     
    );
     
    显示数据库表
    show tables;
     
    在数据库中插入数据
    insert into demo values(NULL,"dada","yujianqi2011",27,"beijing");
    insert into demo values(NULL,"xiaoyin","yujianqi2011",26,"shanghai");
     
    查询数据
    select name, city from customers where name="dada";
     
    更新数据
    update customers 
    set address =  "北京市海淀区";
     
    删除数据
    delete from dada where name = "dada";
     
    表的删除
    DROP TABLE table;
     
    数据删除
    DROP DATABASE database;
    学透前端行业所有技术,玩遍北京周边所有城市。然后我会回到那个生我养我的地方,因为有亲人的地方才是家。
  • 相关阅读:
    hdu 4334 Trouble
    hdu 4324 Triangle LOVE
    hdu 4255 A Famous Grid
    hdu 3549 Flow Problem
    hdu 3371 Connect the Cities
    hdu 2846 Repository
    hdu 2120 Ice_cream's world I
    P3304 [SDOI2013]直径(【模板】树直径的必经边)
    P5490 【模板】扫描线
    P1364 医院设置(【模板】树的重心)
  • 原文地址:https://www.cnblogs.com/snowinmay/p/3166809.html
Copyright © 2011-2022 走看看