• Mysql基础语句


     Navicat Premium 数据库管理工具

    SQL语句:

    数据库语句:

    ---查看当前数据库:
        show databases;
    ---创建数据库: create database dbname1
    ---进入数据库:
        use dbname1
    ---删除数据库:
    drop database dbname1

    数据表语句:

    ---查看数据表:
        show tables;
    ---创建数据表:
        create table _category(id int primary key auto_increment,name varchar(50),description varchar(200);
    ---根据已有的表创建新表:    A:create table tab_new like tab_old (使用旧表创建新表) B:create table tab_new as select col1,col2… from tab_old definition only
    ---添加一列: alter table table_name add field3 int
    ---删除列: alter table table_name drop field3
    ---删除数据表:   drop table table_name

    使用工具创建表:(Navicat)

    基础sql语句:

    ---查找:
        select * from table1 where accounts='100100'
    ---插入: insert into table1 (field1,field2) values(value1,value2)
    ---更改: update table1 set field1=value3 where 范围
    ---删除: delete from table1 where 范围
    ---查找(like) select * from table1 where field1 like '%value1%'
    ---排序(order by) select * from table1 order by field1 desc
    ---总数: select count as totalcount from table1
    ---求和: select sum(field1) as sumvalue from table1
    ---平均: select avg(field1) as avgvalue from table1
    ---最大: select max(field1) as maxvalue from table1
    ---最小: select min(field1) as minvalue from table1
  • 相关阅读:
    Ruby:Hash 排序
    Rails bug: ROR + A server is already running. Check …/tmp/pids/server.pid. Exiting
    MySQL 删除数据的最好的方式
    FATAL ERROR: The persistent cache of section information does not match the current configu...
    http和https的区别
    SAP BusinessObject < Aggregate Navigation >
    BO Server Session Setting
    BusinessObject Port 配置
    重复提交
    FCKeditor
  • 原文地址:https://www.cnblogs.com/happy-xiaoxiao/p/9012522.html
Copyright © 2020-2023  润新知