Remove Primary Key in MySQL

I have the following table schema which maps user_customers to permissions on a live MySQL database: mysql> describe user_customer_permission; +——————+———+——+—–+———+—————-+ | Field | Type | Null | Key | Default | Extra | +——————+———+——+—–+———+—————-+ | id | int(11) | NO | PRI | NULL | auto_increment | | user_customer_id | int(11) | NO | PRI … Read more

What are best practices for multi-language database design? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for … Read more

What’s the longest possible worldwide phone number I should consider in SQL varchar(length) for phone

What’s the longest possible worldwide phone number I should consider in SQL varchar(length) for phone. considerations: + for country code () for area code x + 6 numbers for Extension extension (so make it 8 {space}) spaces between groups (i.e. in American phones +x xxx xxx xxxx = 3 spaces) here is where I need … Read more

First-time database design: am I overengineering? [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 years ago. Improve this question Background I’m a first year CS student and I work part time for my dad’s small … Read more

“Prevent saving changes that require the table to be re-created” negative effects

Preamble I was modifying a column in SQL Server 2008 today, changing the datatype from something like currency(18,0) to (19,2). I got the error “The changes you have made require the following tables to be dropped and re-created” from SQL Server. Before you scramble to answer, please read the following: I already know there is … Read more

Schema for a multilanguage database

I’m developing a multilanguage software. As far as the application code goes, localizability is not an issue. We can use language specific resources and have all kinds of tools that work well with them. But what is the best approach in defining a multilanguage database schema? Let’s say we have a lot of tables (100 … Read more

What’s wrong with foreign keys?

I remember hearing Joel Spolsky mention in podcast 014 that he’d barely ever used a foreign key (if I remember correctly). However, to me they seem pretty vital to avoid duplication and subsequent data integrity problems throughout your database. Do people have some solid reasons as to why (to avoid a discussion in lines with … Read more

What does principal end of an association means in 1:1 relationship in Entity framework

public class Foo { public string FooId{get;set;} public Boo Boo{get;set;} } public class Boo { public string BooId{get;set;} public Foo Foo{get;set;} } I was trying to do this in Entity Framework when I got the error: Unable to determine the principal end of an association between the types ‘ConsoleApplication5.Boo’ and ‘ConsoleApplication5.Foo’. The principal end of … Read more

What does ON [PRIMARY] mean?

I’m creating an SQL setup script and I’m using someone else’s script as an example. Here’s an example of the script: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE TABLE [dbo].[be_Categories]( [CategoryID] [uniqueidentifier] ROWGUIDCOL NOT NULL CONSTRAINT [DF_be_Categories_CategoryID] DEFAULT (newid()), [CategoryName] [nvarchar](50) NULL, [Description] [nvarchar](200) NULL, [ParentID] [uniqueidentifier] NULL, CONSTRAINT [PK_be_Categories] PRIMARY KEY CLUSTERED … Read more