zoukankan      html  css  js  c++  java
  • 【MySQL】常用的命令

    连接数据库

    mysql -u root -p
    mysql -u root -h 192.168.16.140 -p

    创建数据库

    create database dbstudents;

    查看所有数据库

    show databases;

    选择数据库

    use dbstudents;

    创建数据表

    create table tbstudents
    (
    学号 int primary key,
    姓名 varchar(30) not null,
    性别 varchar(30) not null,
    );

    插入数据

    insert into tbstudents(学号,姓名,性别)
    VALUES
    (2055,"张三","男"),
    (2056,"张四","男"),
    (2057,"张五","女"),
    (2058,"张六","男");

    创建数据表

    create table tbscore
    (
    学号 int primary key,
    语文 int not null,
    数学 int not null,
    英语 int not null
    );

    插入数据

    insert into tbscore(学号,语文,数学,英语)
    VALUES
    (2055,100,99,98),
    (2056,99,99,98),
    (2057,89,91,93),
    (2058,44,69,68);

    查看表格结构

    desc tbstudents;
    desc tbscore;

    生成视图

    create view 查询表 as select tbstudents.学号,姓名,语文,数学,英语 from tbstudents,tbscore where tbstudents.学号=tbscore.学号;

    退出数据库

    quit;
  • 相关阅读:
    sitemesh包装工具
    关于对XML的处理
    关于打开tomcat的远程调试功能
    hdu4531 乾坤大挪移
    hdu4521 小明序列 (线段树 + DP)
    hdu4527 && hdu4528
    zoj3691 Flower
    pku2817 WordStack
    zoj3652 Maze
    zoj3381 Osaisen Choudai!
  • 原文地址:https://www.cnblogs.com/KMould/p/12196513.html
Copyright © 2011-2022 走看看