mysql

What's the difference between utf8_unicode_ci and utf8mb4_0900_ai_ci

微笑、不失礼 提交于 2021-02-15 11:36:51
问题 What is the difference between utf8mb4_0900_ai_ci and utf8_unicode_ci database text coding in mysql (especially in terms of performance) ? 回答1: The encoding is the same. That is, the bytes look the same. The character set is different. utf8mb4 has more characters. The collation (how comparisions are done) is different. The perfomance is different, but it rarely matters. utf8_unicode_ci implies the CHARACTER SET utf8 , which includes only the 1-, 2-, and 3-byte UTF-8 characters. Hence it

ruby-on-rails-BUG

 ̄綄美尐妖づ 提交于 2021-02-15 10:52:50
Ruby on Rails errors: (新手期) rails 自动化部署教程 Q1: rvm 无法使用 $ rvm use 1.9.3 --default RVM is not a function, selecting rubies with 'rvm use ...' will not work. You need to change your terminal emulator preferences to allow login shell. Sometimes it is required to use `/bin/bash --login` as the command. Please visit https://rvm.io/integration/gnome-terminal/ for an example. 使用: source ~/.rvm/scripts/rvm 或者: echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' >>~/.bashrc source ~/.bashrc Q2: bundle install httpError run bundle install The dependency tzinfo-data (>= 0) will be

【大数据】Hive学习笔记

依然范特西╮ 提交于 2021-02-15 09:58:28
第 1 章 Hive 基本概念 1.1 什么是 Hive Hive :由 Facebook 开源用于解决海量结构化日志的数据统计。 Hive 是基于 Hadoop 的一个 数据仓库工具 ,可以将 结构化的数据文件映射为一张表 ,并提供 类 SQL 查询功能。 本质是:将 HQL 转化成 MapReduce 程序 1 ) Hive 处理的数据存储在 HDFS 2 ) Hive 分析数据底层的实现是 MapReduce 3 )执行程序运行在 Yarn 上 1.2 Hive 的优缺点 1.2.1 优点 1) 操作接口采用类 SQL 语法,提供快速开发的能力(简单、容易上手) 。 2) 避免了去写 MapReduce ,减少开发人员的学习成本 。 3) Hive 的执行延迟比较高,因此 Hive 常用于数据分析,对实时性要求不高的场合 。 4) Hive 优势在于处理大数据,对于处理小数据没有优势,因为 Hive 的执行延迟比较高 。 5) Hive 支持用户自定义函数,用户可以根据自己的需求来实现自己的函数 。 1.2.2 缺点 1.Hive 的 HQL 表达能力有限 ( 1 )迭代式算法无法表达 ( 2 )数据挖掘方面不擅长 , 由于 MapReduce 数据处理流程的限制,效率更高的算法却无法实现。 2.Hive 的效率比较低 ( 1 ) Hive 自动生成的 MapReduce

Django连接MySQL数据库

主宰稳场 提交于 2021-02-15 09:46:09
CREATE DATABASE 'mysite' DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; 在myslq中创建mysite数据库 修改应用polls包里面的models.py from django.db import models # Create your models here. # 在我们的polls应用程序中, # 将创建两个模型:Question和Choice, # Question有一个问题和一个出版日期, # Choice有两个领域:选择的文本和票数, # 每个Choice都关联一个Question class Question(models.Model): question_text = models.CharField( max_length= 200) pub_date = models.DateTimeField( '出版日期') class Choice(models.Model): question = models.ForeignKey(Question , on_delete=models.CASCADE) choice_text = models.CharField( max_length= 200) votes = models.IntegerField( default= 0)

Django连接mysql数据库

二次信任 提交于 2021-02-15 09:45:50
django连接数据库 1 .需要修改配置文件 DATABASES = { ' default ' : { ' ENGINE ' : ' django.db.backends.mysql ' , ' NAME ' : ' day54 ' , ' HOST ' : ' 127.0.0.1 ' , ' PORT ' :3306 , ' USER ' : ' root ' , ' PASSWORD ' : ' 123 ',           #表情          'OPTIONS': {'charset':'utf8mb4'} } } ps:键必须都是大写 2 .告诉django用pymysql替换它默认mysqldb模块连接数据库 方式1:在你的项目文件夹下面的__init__.py 方式2:也可以在你的应用文件夹下面的__init__.py # 固定写法 import pymysql pymysql.install_as_MySQLdb() # 告诉django用pymysql代替mysqldb连接数 来源: oschina 链接: https://my.oschina.net/u/4380963/blog/4113796

django | 连接mysql数据库

柔情痞子 提交于 2021-02-15 09:45:25
django 2.1 + mysql 5.6 1.在setting中设置 DATABASES = { ' default ' : { ' ENGINE ' : ' django.db.backends.mysql ' , ' NAME ' : ' test ' , ' USER ' : ' root ' , ' PASSWORD ' : ' 123456 ' , ' HOST ' : ' 127.0.0.1 ' , ' PORT ' : ' 3306 ' , } } 2.下载mysqlclit 来源: oschina 链接: https://my.oschina.net/u/4413558/blog/4087542

Django:在OS X环境下连接MySQL数据库

倾然丶 夕夏残阳落幕 提交于 2021-02-15 09:37:22
安装库 正常的安装只需要执行以下2条命令: $ brew install mysql-connector-c $ pip3 install mysqlclient 但在执行 pip3 install mysqlclient 时,出现报错: which () { IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' for file do :112 File "<string>", line 1, in <module> File "/private/var/folders/k9/q3cgwmcx4l51554_97h5rx4h0000gn/T/pip-install-n_ai97oc/mysqlclient/setup.py", line 16, in <module> metadata, options = get_config() File "/private/var/folders/k9/q3cgwmcx4l51554_97h5rx4h0000gn/T/pip-install-n_ai97oc/mysqlclient/setup_posix.py", line 63, in get_config libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')] File "

How do I use another column if two rows in the first column checked are the same?

て烟熏妆下的殇ゞ 提交于 2021-02-15 07:48:28
问题 I have a table that looks something like this: stones ID number snumber wt qt 1 a 11.5 13 2 c 4.0 8 3 a a1 1.0 2 4 d 0.5 1 5 b 2.0 4 6 a a2 5.0 1 7 f 3.0 6 8 a a3 5.0 10 How do I select all from stones and if the column number has rows in the column snumber only give results from snumber 's rows [otherwise use number ]? I am also trying to incorporate in my previous [working] code that selects all rows in the table that wt >= 2.5 then count all those rows as totalrows : SELECT inv.*, COUNT(*)

How do I use another column if two rows in the first column checked are the same?

时间秒杀一切 提交于 2021-02-15 07:48:23
问题 I have a table that looks something like this: stones ID number snumber wt qt 1 a 11.5 13 2 c 4.0 8 3 a a1 1.0 2 4 d 0.5 1 5 b 2.0 4 6 a a2 5.0 1 7 f 3.0 6 8 a a3 5.0 10 How do I select all from stones and if the column number has rows in the column snumber only give results from snumber 's rows [otherwise use number ]? I am also trying to incorporate in my previous [working] code that selects all rows in the table that wt >= 2.5 then count all those rows as totalrows : SELECT inv.*, COUNT(*)

mysql selecting all rows from one table even if no match in other using middle table

爷,独闯天下 提交于 2021-02-15 07:47:02
问题 I am having trouble with selecting all rows from a table and populating non matching ones with 0. Table "modul" ---------------------------------------------------------- | id | menu_name | modul_name | all_access | ---------------------------------------------------------- 1 books book 0 2 cds cd 0 3 tapes tape 0 table "user" -------------------- | id | username | -------------------- 1 vedran table "user_modul" ------------------------------------------ | id | user_id | modul_id | active |