English 中文(简体)
不一致的数据库
原标题:Database with inconsistencies

(一米使用LQ3)

我的议席有的领域。

Name
Zipcode
State
City
State
StreetAddress

问题是,在名称领域,人们输入的数据不一致。

例如,

Name (single column)
====================
John Smith MD
Jason Young M.D
Charlie Horse MD.
Kim Powell PH.d
Sandy Fox Phd M.D.

我想清除作为M.D.和Ped/PH.d用于博士的计量吸入器(请记住名字是1个领域)。

街道地址也存在多个问题,如言语而不是1。

Can someone please explain what I can do to format the data? I could do it manually but it would take too long!

最佳回答

对于地址,您不妨对照贵国区域/国家具体地址数据库加以验证。

我想清理作为M.D.和Phd/PH.d而节约的计量吸入器(请记住名称是1个领域)。

考虑了所有各种MD和PHD,并进行了一系列更新:(replace function):

update tbl set name = replace(name,  M.D. ,  MD )
update tbl set name = replace(name,  MD. ,  MD )
update tbl set name = replace(name,  M.D ,  MD )
update tbl set name = replace(name,  M.D ,  MD )
update tbl set name = replace(name,   MD ,   MD )  -- fix case, hope no name starts with "MD"
update tbl set name = replace(name,  PHD ,  PhD )  -- fix case
update tbl set name = replace(name,  PH.D ,  PhD )  -- fix case
update tbl set name = replace(name,  PH-D ,  PhD )  -- fix case
etc for any other variants you can think of or encounter

街道地址也存在多种问题,如言词之间的多个空间,而不是1个。

在消除分界线之后,将两个空间替换为一、二次。 为了更快地破坏一系列空间,我们使用8-和11;1 两度,然后是4-和;1,然后是2-和;1

update tbl set address = replace(address,  
 ,    )
update tbl set address = replace(address,  
 ,    )
update tbl set address = replace(address,           ,    )
update tbl set address = replace(address,           ,    )
update tbl set address = replace(address,       ,    )
update tbl set address = replace(address,       ,    )
update tbl set address = replace(address,     ,    )
update tbl set address = replace(address,     ,    )
问题回答

您只接受用户界面的数据,立即坚持数据库中的数据而不加以验证和篡改。 你们从这种方式的卡片注射中更安全。

我不知道你的看法和坚持的等级之间有什么目标,但我建议,在你的控制层或服务层,最好是控制器,增加一个验证和具有约束力的层次。

http://code.google.com 各类数据清理大

This is a series of string translations. Most of them are easy, and regex s may not be required for many of them.

简单算法:

(1) 空间名称

(2) 弃置空数值,即两个或两个以上空间的结果

3) 取得每笔价值,转换为上例,删除时间、回历或任何其他东西,并在“千年发展目标”等已知的颜料表中找到,并以预期价值取代。

4) 从第3步开始,任何不匹配的休假,都算起。

显然,这要求你制定一份已知的沙子清单,如MD,等等。 这不是坏事。 在直接营销中这样做的大型专业产品就是这样办理的。

5) 验证由此产生的价值

没有关于格式名称的正确定义,这是你想要达到多少一致性的问题。

除此之外,Duffy的建议是正确的。

All of the above are sound and probably necessary. I d like to add that it is also preferable to limit the input on fields as much as possible. For example the suffixes field should be limited to pre-validated values by using a drop-down list. This simplifies the data entry and data verification.

定期表达和扼杀性操作可以用于有限的地址数据子集,但地址行业有许多例外情形。 美国邮政管理处是这里的主管机构(至少是美国地址),因此不使用美国邮政管理处认证的服务?

地址:

智能Streets还为低使用率用户提供免费订阅。 I m是SartyStreets的一个软件开发商,帮助了这两个服务。





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

难以执行 REGEXP_SUBSTR

I m 查询Oracle 10g。 我有两张表格(样本数据见下文)。 i m 试图提取一些领域

SQL Query Shortcuts

What are some cool SQL shorthands that you know of? For example, something I learned today is you can specify to group by an index: SELECT col1, col2 FROM table GROUP BY 2 This will group by col2

PHP array callback functions for cleaning output

I have an array of output from a database. I am wondering what the cleanest way to filter the values is example array Array ( [0] => Array ( [title] => title 1 ...

OracleParameter and DBNull.Value

we have a table in an Oracle Database which contains a column with the type Char(3 Byte). Now we use a parameterized sql to select some rows with a DBNull.Value and it doesn t work: OracleCommand ...

Running numbers in SQL

I have a SQL-statement like this: SELECT name FROM users WHERE deleted = 0; How can i create a result set with a running number in the first row? So the result would look like this: 1 Name_1 2 ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签