• 数据库知识


    1.nvarchar(20)
    varchar(20)

    2.删除truncate table car (id 自增时 会有影响 重新编号)
    truncate 会删除该表所有的记录
    truncate当表被清空后表和表的索引讲重新设置成初始大小,而delete删除所有记录时则不能。
    truncate 之后自增id会从1重新编号,而delete删除所有记录时则不会
    https://blog.csdn.net/ws0513/article/details/49980547

    3.获取列名 select * from tale where 1=0
    获取所有的 select * from tale where 1=1
    4.(一共三条)
    select * from table1 where (id>=1 and id<=2)and id = 3 (空)
    select * from table1 where (id>=1 or id<=2)and id = 3 (选出id= 3)
    select * from table1 where id>=1 or id<=2 and id = 3 (所有的,id>=0 真 不会计算or后面的)

    5。like%吗%(开头或结尾为吗也可以查出来)
    6.单独表备份 :select * into table1_bak from table1 (后面也可以加where )这是sql server中的用法
    MYSQL方法:
    Create table new_table_name (Select * from old_table_name);
    7.getdate() 2018-05-19 14:14:29.410
    日期类型 也可以写成 2018/05/12
    8.select * from (结果集) a 结果集必须要有一个别名
    9.group by having sum()>10 groupby必须和having 一起用
    10.查重 select id,count(id) from table group by id having count(id)>1 (id 重复)
    11.去重 select distinct id from table1
    12.前几行 select top 1 * from table1 (所有字段)
    select top 1 name from table1 (sql server)
    select * from table limit 1(mysql)

    13.5 inner join 4 where 1=1 时 条数:5*4
    A full join B A full join 关联B时 B没的用null 填充 ,A中没有也用null 填充
    14.union (不会有重复的记录)
    union all (会用重复的记录)
    https://blog.csdn.net/zouxucong/article/details/73468979

  • 相关阅读:
    POJ2376 Cleaning Shifts
    百度首页图标
    NOIP2016换教室
    CH3803扑克牌
    【POJ2723】Get Luffy Out
    【USACO13DEC】 最优挤奶
    【SP2916】Can you answer these queries V
    【线段树】各种模板集合
    【SCOI2013】摩托车交易
    【CF1174D】 Ehab and the Expected XOR Problem
  • 原文地址:https://www.cnblogs.com/xiaobaidejiucuoben/p/9443680.html
Copyright © 2020-2023  润新知