zoukankan      html  css  js  c++  java
  • mysql基本操作(一)

    库操作:
    show databases;//显示全部数据库
    drop database  dbName;//删除数据库
    create database [if not exists] dbName;//创建数据库
    use dbName;//使用数据库
    show tables;//显示当前使用数据库的表名
    desc tableName;//显示具体的表结构
    表操作:
    drop table tableName;//删除表
    -create table tableName(uId int,uPrice decimal);//创建一个有uId和uPrice字段的数据表
    -create table newtableName(uId int) as select uId from user;//从数据表user中复制uId列到新的数据表中并且创建该新表
    -create table newtableName as select * from user;
    单列:alter table tableName add tel varchar(11) default '14545';//添加表里面的字段
    -多列:alter table tableName add(photo blob,birthday data);//添加多列
    alter table olduserName rename to newuserName;//重命名表名
    alter table tableName change oldName newName varchar(10);//字段重命名
    alter table tableName modify tel varchar(15) default48777777889979’ first;修改tel字段并且让他在第一列显示
    alter table tableName drop tel;//删除tel字段
  • 相关阅读:
    工科物理实验()中国大学MOOC答案(已更新)
    类似jar文件使用java无法打开问题
    python9、10章
    nmap的理解与利用(初级)
    常见端口
    配置优化
    删除表操作
    万能的map
    测试
    Mapper.xml
  • 原文地址:https://www.cnblogs.com/zzy-frisrtblog/p/5729443.html
Copyright © 2011-2022 走看看