Hi all,
I'm pretty new to MySQL, but have some Access background. I've created
a table for which I intended the email column to be the primary key,
but didn't specify it at creation. Now, I'm trying to figure out how
to specify it post facto.
Thanks,
blanch 1 1532
blanch wrote: Hi all,
I'm pretty new to MySQL, but have some Access background. I've created a table for which I intended the email column to be the primary key, but didn't specify it at creation. Now, I'm trying to figure out how to specify it post facto.
alter table add primary key (email_column); http://dev.mysql.com/doc/mysql/en/ALTER_TABLE.html
But I have to point out that using email as a primary key isn't usually
an appropriate choice.
Is a given user's email address never going to change? If it can
change, how do other tables that reference this one make sure they
reference the correct record? You can enforce this behavior
automatically by declaring foreign keys with the ON UPDATE CASCADE
clause, but you have to remember to do that. And note that referential
integrity only works with InnoDB tables. See http://dev.mysql.com/doc/mysql/en/In...nstraints.html
Sorry to make trouble! :-) I just want you to avoid difficulty later on.
It'd be better for data management to assign another column to be the
primary key. This column should have no significance other than its use
to uniquely identify the record. Therefore it has no reason to change
its value. It is customary to use an integer column for this purpose.
Regards,
Bill K. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: js |
last post by:
I am trying to create a primary key constraint on a view in the
following statement. However, I got an error ORA-00907: missing right
parenthesis. If the CONSTRAINT clause is removed, then the view is
created fine. Does anyone know how to creat Primary Key Constraint
for a View? Thanks.
CREATE OR REPLACE VIEW RPT_VW_WMN (
CARD, EC_D_CODE, EC_M_CODE,
START_DATE, PR_NAME, PR_ID, ELIG, ANNUALY, MONTHLY, PENDING,
/* ORA-00907: missing...
|
by: blanch |
last post by:
Hi all,
I'm pretty new to MySQL, but have some Access background. I've created
a table for which I intended the email column to be the primary key,
but didn't specify it at creation. Now, I'm trying to figure out how
to specify it post facto.
Thanks,
blanch
|
by: Philip Yale |
last post by:
I'm probably going to get shot down with thousands of reasons for
this, but I've never really heard or read a convincing explanation, so
here goes ...
Clustered indexes are more efficient at returning large numbers of
records than non-clustered indexes. Agreed? (Assuming the NC index
doesn't cover the query, of course)
Since it's only possible to have one clustered index, why is this
almost always used for the primary key, when by...
|
by: Peter Scott |
last post by:
I created a table that has a column in that needs to contain a full
Unix file path. Since 2048 was too long for a VARCHAR, I made it
TEXT. I since populated the table. Now I want to make the path
column a primary key, and I can't figure out how. (I googled the
web and groups without luck, looked over the reference manual also,
especially reading the entry on BLOBs.)
I was able to make a fulltext index with:
create fulltext index...
|
by: mel_palmeruk |
last post by:
Hi
I am having trouble with ms-access and trying to determind whether or
not a row already exisitng in a particular table.
I have 3 tables namly Projects, ProjectsAttencedByContact,
ContactDetails
Defined as below.
Projects ProjectsAttendedByContact ContactDetails
| |
by: Beryl Small |
last post by:
Have a datalist bound to a dataset. When I run the following code it
deletes the selected record from the screen but not from the underlying
table. The dataset is made up of three joined tables, the primary key on
the main table is made up of two fields (ClassID and StudentID) can anyone
tell me why my code does not work?
Private Sub dlSchedule_ItemCommand(ByVal source As Object, ByVal e As...
|
by: Kenny M. |
last post by:
hi
I have a WebForm1 with a button to navigate using Response.Redirect
("myPage2",true) and I have notice that the Webform1 makes a complete
PostBack before leave, and that is making my app more heavy, how can stop it
because the postback of the Webform1 is unneeded
any sugg?
--
|
by: Bernie Yaeger |
last post by:
I have a need to add a primary key to a dataset/datatable. How can this be
done using a standard oledb data provider?
Tx for any help.
|
by: archana |
last post by:
Hi all,
I want to make one column of listview as multiline.
My problem is my text contains multiple line. When i display that text
in listview newline characters are not getting displayed properly.
What should i do to make it properly readable?
Any help will be truely apprecaited.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |