当前位置: 首页 > 编程日记 > 正文

第一讲SQL命令的DDL和DML操作讲解

知识点:

一、sql命令DDL(结构化操作)

二、sql命令DML操作(增删改查)

1.sql命令DDL(结构化操作)

1.1表添加字段:

alter table 表名 add 列定义

如:

alter table Student add email varchar(128);

1.2 修改字段:

alter table 表名 change 旧字段名 新字段名;

alter table Student change email StuEmail varchar(256);

1.3删除字段:

alter table 表名 drop 字段

alter table Student drop StuEmail;

1.4 修改表名称

alter table 表名rename 新表名

alter table Student rename NewStu;

1.5 删除表操作

drop table 表名

drop table NewStu;

二、SQL DML操作(增删改查)

2.1 增加:

insert into 表名(字段1,。。。) values(val1,...);

insert into Student(stuNum,StuName,StuAage,StuSex) values('0001','demo1',28,1);

2.2 查看:

select * from 表名

select * from Student;

修改Mysql字符集:

如果出现乱码,可能是字符集设置不准确:

用 set 变量=字符集 修改,如:

查看Mysql系统变量:

show variables;

查看字符集的系统变量:

show variables like '%character%';

注意:set names  gbk;命令只起到临时作用。

2.3修改表记录:

update 表名 set 字段=值,。。。;

update Student set StuName='余小东' where StuNum = '0001'

3.删除表记录

delete from 表名 where 条件

delete from Student where StuNum = '0001'

4.表查询:

select 字段列表 from 表名[where 条件] [order by 字段 asc|desc][limit 起始位置 长度][group by 字段];

转载于:https://www.cnblogs.com/wshnx/p/6366209.html

相关文章:

基于Tkinter利用python实现颜色空间转换程序

主要基于colorsys实现,例子是从hls转换到rgb,假设要换颜色空间非常easy仅仅须要改动一个函数 用到了Scale和Canvas组件 代码例如以下: from Tkinter import * import colorsys #操作后的响应函数 def update(* args):colorr,g,b colorsys.hl…

react 时刻表插件_React“啊哈”的时刻

react 时刻表插件As a teacher, one of my main goals is to maximize people’s “aha” moments.作为一名老师,我的主要目标之一是最大限度地利用人们的“哈哈”时刻。 An “aha” moment is a moment of sudden insight or clarity, where the subject starts t…

同样在JavaScript中

ES6有三个内置决定一些设施x和一些y是“相同的”。 它们是:平等或“双等于”(),严格平等或平等“三重”(),Object.is。 (注意,Object.is在ES6补充道。 等于两倍和三倍等于存在ES6之前,和他们的行为没有改变。) 概述 演示,下面是三个同样使用的比较: x y x y Object。是(x,…

5-flutter 布局和列表

布局和列表 类型作用特点Container只有一个子 Widget。默认充满,包含了padding、margin、color、宽高、decoration 等配置。Padding只有一个子 Widget。只用于设置Padding,常用于嵌套child,给child设置padding。Center只有一个子 Widget。只…

shell awk实战

一、文本处理 1、按行提取关键字频次(如取第5列) awk BEGIN{FS"|"} {a[$5]1;} END {for(i in a) print i ":" a[i];} OPT.ForumLogicNewServer_action_20161107.log | sort -nrk 2 -t : 2、日志用户每分钟访问量统计 这里我们统计日…

pix怎么抚养另一只猫_在工作和抚养两个孩子的同时,我如何在一年内获得第二学位并获得了5个开发人员认证...

pix怎么抚养另一只猫“The standard pace is for chumps. The system is designed so anyone can keep up. If you’re more driven than ‘just anyone’ — you can do so much more than anyone expects. And this applies to ALL of life — not just school.” — Derek S…

Wireshark网络抓包(三)——网络协议

一、ARP协议 ARP(Address Resolution Protocol)地址解析协议,将IP地址解析成MAC地址。 IP地址在OSI模型第三层,MAC地址在OSI第二层,彼此不直接通信; 在通过以太网发生IP数据包时,先封装第三层&a…

实现Java中的ArrayList

最近深受轮子哥影响,觉得造一些轮子应该会对自己的技术功底有一定的帮助,就决定先从简单的容器开始实现。废话不多说,就先实现一个Java中的ArrayList。 ArrayList是我们在Java中使用非常多的一个类,它是顺序表的数组实现&#xff…

6-flutter 状态管理

1 StatelessWidget 不需要状态改变的widget,它没有要管理的内部状态。 Text,CircleAvator 都是其子类 其传递的参数别final 修饰,不可变的 无状态的widget build 方法在以下三种情况下进行调用 当widget 插入到数中去当widget 父级更改配置的时候当…

大二上学数据结构和操作系统_毕业后的工作比上学要重要得多。 这是数据。...

大二上学数据结构和操作系统by Aline Lerner通过艾琳勒纳(Aline Lerner) 毕业后的工作比上学要重要得多。 这是数据。 (What you do after you graduate matters way more than where you went to school. Here’s the data.) The first blog post I published that got any r…

关于C#中编译器保证变量必须初始化规则猜想

现在两种情况: 第一种情况: using System; namespace Wrox {public class Program{static void Main(string[] args){int index; if(true){ index 100; } Console.WriteLine(index); Cons…

Bootstrap table表格

Bootstrap table 使用类 Class"table" 既可让table美化样式 table 相关的Class 隔行换色 : table-striped 鼠标悬停效果: table-hover 表格的边框 : table-bordered 垂直居中 : vertical-align 表头颜色:c…

flutter报错Could not connect to lockdownd, error code -

关于 flutter 报错信息解决方案 第一步: cmdshiftg 前往 /var/db 文件夹,找到lockdown文件夹,修改读写权限 第二步 : 打开命令行,依次执行 brew update brew uninstall --ignore-dependencies libimobiledevice brew uninstall…

k8s aws 部署_如何在短短30分钟内使用CircleCI设置到AWS S3的持续部署

k8s aws 部署by Adam Watt通过亚当瓦特 如何在短短30分钟内使用CircleCI设置到AWS S3的持续部署 (How to setup Continuous Deployment to AWS S3 using CircleCI in just 30 minutes) Continuous Deployment might seem complicated at first, but don’t be intimidated. In…

SharePoint 2010 单点登录

SharePoint2010单点登录 1.进入管理中心》应用程序管理 2.找到 Secure Store Service 应用程序代理 3.然后就是新建了 5.输入网站集管理员 6.这个时候SharePoint就知道你需要给OA这个系统做单点登录了。 7.下一步就是我们要把我们进OA系统的帐号密码告诉SharePoint&#xff0c…

Java IO流学习总结三:缓冲流-BufferedInputStream、BufferedOutputStream

Java IO流学习总结三:缓冲流-BufferedInputStream、BufferedOutputStream 转载请标明出处:http://blog.csdn.net/zhaoyanjun6/article/details/54894451 本文出自【赵彦军的博客】 InputStream |__FilterInputStream|__BufferedInputStream 首先抛出一个…

7-flutter Navigator 和Route

Route 和 Navigator 用于页面之间的跳转 一 Navigator 的 push 和 pop 用于页面之间的跳转 创建MaterialApp时可以指定routes参数,该参数是一个映射路由名称和构造器的Map 跳转的时候 使用 push 跳回的时候使用 pop import package:flutter/cupertino.dart; im…

小规模网络数据公开数据_大规模的在线公开课程曾经是100%免费的。 但是他们没有那样做。...

小规模网络数据公开数据I took one of the first Massive Open Online Courses (MOOCs) in 2011. Back then, everything was 100% free: the videos, the assignments, and the certificates. But in 2017, you can’t find this sort of free learning experience anymore.我…

swift -charts框架雷达图

参考资料 import UIKit import Chartsclass ViewController: UIViewController {let activities ["力量", "敏捷", "生命", "智力", "魔法"]override func viewDidLoad() {super.viewDidLoad()// Do any additional setup…

vector容器总结.xml

1 清空所有元素m_itemVector.clear(); 2 遍历vector<ITEM_CHECK>::iterator iterm_itemVector.begin(); for(i0;iter!m_itemVector.end();iter,i) { if(iter->flag-1) { break; } iter->flag1; } vector<ITEM_CHECK>::iterator iterm_itemVector.b…

Syncthing源码解析 - 第三方库

1&#xff0c;AudriusButkevicius/cli 网址&#xff1a;https://github.com/AudriusButkevicius/cli 2&#xff0c;bkaradzic/go-lz4 网址&#xff1a;https://github.com/bkaradzic/go-lz4 3&#xff0c;calmh 备注&#xff1a;这位是Syncthing项目创立者和最主要的开发者&…

安全工程师2017年真题_以下是2017年全球软件工程师的平均薪水

安全工程师2017年真题And here are those same salaries adjusted to San Francisco’s cost of living:以下是根据旧金山的生活费用调整后的相同工资&#xff1a; As you can see, cost of living is an important consideration. Also, you don’t need to move to San Fran…

测试思想 什么是软件测试(摘录)

什么是软件测试(摘录) by:授客 QQ&#xff1a;1033553122 IEEE 标准的定义:使用人工或自动的手段来运行或测定某个系统的过程&#xff0c;其目的在于检验;它是否满足规定的需求或是弄清预期结果与实际结果之间的差别。对软件测试还有一些不同的定义。 G.J.Myers给出的定义:“程…

8-flutter 异步和线程

线程和异步的UI 1 异步的使用 Dart 有一个单线程执行模型&#xff0c;支持Isolate&#xff08;一种在另外一种线程运行dart的方法&#xff09;,一个事件循环和异步编程。 可以使用async / await 来做网络请求不会挂起UI 使用http 导入 import ‘dart:io’; import ‘dart:c…

前端页面紫红色_谷歌正在开发一种神秘的新型移动操作系统,称为紫红色

前端页面紫红色Google seems to be building a replacement for Android called Fuchsia. Yesterday, they revealed what their new Armadillo user interface looks like (see photo above, courtesy of Ars Technica).谷歌似乎正在建立一个名为Fuchsia的 Android替代产品。 …

iOS UIButton 文字图片上下左右布局

例如文字在左 图片在右,iOS 9 之后一句话搞定 backBtn.semanticContentAttribute UISemanticContentAttributeForceRightToLeft;按钮标题居左实现 dateBtn.contentHorizontalAlignment UIControlContentHorizontalAlignmentLeft; dateBtn.contentEdgeInsets UIEdgeInsetsMak…

linux xampp eclipse xdebug 无法进入断点

一、xampp 版本 1.8.3-5 xampp安装后会自动集成xdebug,目录一般为 /opt/lampp/lib/php/extensions/***-debug-***目录 关于php 与php.ini路径 php程序路径为&#xff1a;/opt/lampp/bin/ php.ini配置文件路径为&#xff1a;/opt/lampp/etc/ 1、配置文件一般在/opt/lampp/etc/ph…

sliva数据库简介--转载

sliva rRNA数据库&#xff08;http://www.arb-silva.de/&#xff09;用来检查和比对RNA序列&#xff0c;既可以针对16S/18S,SSU&#xff0c;也可以针对23S/28S, LSU&#xff0c;包括了Bacteria, Archaea and Eukarya。同时也是ARB的官方指定数据库。 LSU: Large subunit (23S/2…

haproxy ssl_我们如何微调HAProxy以实现2,000,000个并发SSL连接

haproxy sslby Sachin Malhotra由Sachin Malhotra 我们如何微调HAProxy以实现2,000,000个并发SSL连接 (How we fine-tuned HAProxy to achieve 2,000,000 concurrent SSL connections) If you look at the above screenshot closely, you’ll find two important pieces of in…

OC文件操作(1)

1.文件的浅度遍历与深度遍历&#xff1a; //NSFileManager * fm [[NSFileManager alloc]init];//创建文件管理器 //第一步创建一个文件管理器 NSError * error nil; //显示路径下的内容,作用类似于ls -a指令 //返回值是把目录下的内容放到NSArray中 //浅度遍历 NSFileManager …