Search Results

Search found 6628 results on 266 pages for 'foreign keys'.

Page 17/266 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • Foreign key reference to a two-column primary key

    - by Adam Ernst
    One of my tables has a two-column primary key: CREATE TABLE tournament ( state CHAR(2) NOT NULL, year INT NOT NULL, etc..., PRIMARY KEY(state, year) ); I want a reference to the tournament table from another table, but I want this reference to be nullable. Here's how I might do it, imagining that a winner doesn't necessarily have a tournament: CREATE TABLE winner ( name VARCHAR NOT NULL, state CHAR(2) NULL, year INT NULL ); If state is null but year is not, or vice-versa, the table would be inconsistent. I believe the following FOREIGN KEY constraint fixes it: ALTER TABLE winner ADD CONSTRAINT FOREIGN KEY fk (name, state) REFERENCES tournament (name, state); Is this the proper way of enforcing consistency? Is this schema properly normalized?

    Read the article

  • insert or update on table violates foreign key constraint

    - by sprasad12
    Hi, I have two tables entitytype and project. Here are the create table statements: Create table project ( pname varchar(20) not null, primary key(pname) ); create table entitytype( entityname varchar(20) not null, toppos char(100), leftpos char(100), pname varchar(20) not null, primary key(entityname), foreign key(pname) references project(pname) on delete cascade on update cascade ); Now when i try to insert any values into entitytype table i am getting the following error: ERROR: insert or update on table "entitytype" violates foreign key constraint "entitytype_pname_fkey" Detail: Key (pname)=(494) is not present in table "project". Can someone please shed some light on what i am doing wrong. Any input will be of great help. Thank you.

    Read the article

  • Ria Services loading foreign keys with Linq-to-SQL

    - by Stephan
    I have a database that consists of 5 tables : Course, Category, Location, CourseCategories, and CourseLocations. The last 2 tables just contain the two foreign keys. A Course has many-to-many relationships with both category and location. I am trying to load the data into a Silverlight app using Ria Services. My DB model is Linq-to-SQL. I have tried adding the [Include] attribute to the metadata classes and I have added the DataLoadOptions so it should load the all tables when you ask for a Course. However on the client side I am never getting back any entries in the CourseCategories and CourseLocations properties. What else needs to be done to get the foreign key relationships to exist across the serialization.

    Read the article

  • Field contains foreign IDs for different tables

    - by Rich
    I am developing a php/mysql driven facebook game. I am stuck on an element the table design. When a user completes a task I want to trigger any number of events. I was thinking of something like so: tbl_events *event_id - serogate primary ID *task_id - foreign ID of the task just completed *event_type - what type of event e.g is it a facebook stream publish or a message to the user or does it unlock a new element of the game? *event_param - this is where it gets tricky... the event parameter is a problem for two reasons, 1) it will contain different foreign ids... dependent on the event_type and thus it will not be possible to join to x table. Meaning I would have to call two queries. 2) Most events require a single id or text, however some events require multiple parameters - like the facebook stream publish.

    Read the article

  • Change list link to foreign key change page

    - by Adam
    When viewing the admin change list for a model, is it possible to make the columns that correspond to foreign keys links to their respective pages? A simple example is I have a Foo object which contains Bar as a foreign key. If I'm viewing the admin change list for Foo (and have it set to include Bar in the display_list columns), the main column would link to the Foo instance's edit page while the Bar column would link to the Boo instance's edit page. I understand I can override the template that's used, but I was curious if there was a solution that didn't require that.

    Read the article

  • MySQL foreign key constraint disappearing

    - by Bramjam
    This is my table: /* oefenreeks leerplan */ CREATE TABLE leerplan_oefenreeks ( leerplan_oefenreeks_id INT PRIMARY KEY AUTO_INCREMENT NOT NULL, leerplan_id INT NOT NULL, oefenreeks_id INT NOT NULL, plaats INT NOT NULL ); /* fk */ ALTER TABLE leerplan_oefenreeks ADD CONSTRAINT fk_leerp_oefenr_leerplan FOREIGN KEY(leerplan_id) REFERENCES leerplan (leerplan_id) ON DELETE CASCADE; ALTER TABLE leerplan_oefenreeks ADD CONSTRAINT fk_leerp_oefenr_oefenreeks FOREIGN KEY(oefenreeks_id) REFERENCES oefenreeks (oefenreeks_id) ON DELETE CASCADE; /* when I execute the nexline, my fk_leerp_oefenr_leerplan constraint vanishes/disappears*/ ALTER TABLE leerplan_oefenreeks ADD CONSTRAINT un_leerp_oefenr UNIQUE(leerplan_id, oefenreeks_id); ALTER TABLE leerplan_oefenreeks ADD CONSTRAINT un_leerp_oefenr_plaats UNIQUE(leerplan_id, plaats); When I go and check only 3 constraints exist. fk_leerp_oefenr_leerplan disappears. I don't understand why this happens.

    Read the article

  • Working in a Foreign Country [closed]

    - by iersoy
    How does it look like to be working in a foreign country? can u share your experiences with me? Is MCPD or MCITP certification and TOEFL-IELTS-Cambridge degrees will be enough for working in a foreign country? What needs to be done to find an employer to work in his/her company? EDIT: I live in Turkey,Istanbul and i like to work in one of these countries: USA UK Germany Italy France Sweden Denmark Finland Norway Switzerland Austria Holland Belgium Canada i need to make quick moves about my career and my path nowadays Thanks a lot

    Read the article

  • SQL update a table with a foreign key

    - by drousseau
    I have a categories table, which one of the fields serves as the foreign key for a sub-categories table. One field that serves as part of the primary key for each table is the language id. I need to update these in both tables. Basically, wherever the language id = x in both tables, I need to set it to y. When I try to do an update on either table, I get a 'The UPDATE statement conflicted with the REFERENCE constraint..' which refers to the foreign key constraint. How can I update the language field on both of these tables?

    Read the article

  • Cascading Deletes in SQL Sever 2008 not working.

    - by Vaccano
    I have the following table setup. Bag | +-> BagID (Guid) +-> BagNumber (Int) BagCommentRelation | +-> BagID (Int) +-> CommentID (Guid) BagComment | +-> CommentID (Guid) +-> Text (varchar(200)) BagCommentRelation has Foreign Keys to Bag and BagComment. So, I turned on cascading deletes for both those Foreign Keys, but when I delete a bag, it does not delete the Comment row. Do need to break out a trigger for this? Or am I missing something? (I am using SQL Server 2008) Note: Posting requested SQL. This is the defintion of the BagCommentRelation table. (I had the type of the bagID wrong (I thought it was a guid but it is an int).) CREATE TABLE [dbo].[Bag_CommentRelation]( [Id] [int] IDENTITY(1,1) NOT NULL, [BagId] [int] NOT NULL, [Sequence] [int] NOT NULL, [CommentId] [int] NOT NULL, CONSTRAINT [PK_Bag_CommentRelation] PRIMARY KEY CLUSTERED ( [BagId] ASC, [Sequence] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO ALTER TABLE [dbo].[Bag_CommentRelation] WITH CHECK ADD CONSTRAINT [FK_Bag_CommentRelation_Bag] FOREIGN KEY([BagId]) REFERENCES [dbo].[Bag] ([Id]) ON DELETE CASCADE GO ALTER TABLE [dbo].[Bag_CommentRelation] CHECK CONSTRAINT [FK_Bag_CommentRelation_Bag] GO ALTER TABLE [dbo].[Bag_CommentRelation] WITH CHECK ADD CONSTRAINT [FK_Bag_CommentRelation_Comment] FOREIGN KEY([CommentId]) REFERENCES [dbo].[Comment] ([CommentId]) ON DELETE CASCADE GO ALTER TABLE [dbo].[Bag_CommentRelation] CHECK CONSTRAINT [FK_Bag_CommentRelation_Comment] GO The row in this table deletes but the row in the comment table does not.

    Read the article

  • Using Constraints on Hierarchical Data in a Self-Referential Table

    - by pbarney
    Suppose you have the following table, intended to represent hierarchical data: +--------+-------------+ | Field | Type | +--------+-------------+ | id | int(10) | | parent | int(10) | | name | varchar(45) | +--------+-------------+ The table is self-referential in that the parent_id refers to id. So you might have the following data: +----+--------+---------------+ | id | parent | name | +----+--------+---------------+ | 1 | 0 | fruit | | 2 | 0 | vegetable | | 3 | 1 | apple | | 4 | 1 | orange | | 5 | 3 | red delicious | | 6 | 3 | granny smith | | 7 | 3 | gala | +----+--------+---------------+ Using MySQL, I am trying to impose a (self-referential) foreign key constraint upon the data to update on cascades and prevent deletion of fruit if they have "children." So I used the following: CREATE TABLE `idtlp_main`.`fruit` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `parent` INT(10) UNSIGNED, `name` VARCHAR(45) NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `fk_parent` FOREIGN KEY (`parent`) REFERENCES `fruit` (`id`) ON UPDATE CASCADE ON DELETE RESTRICT ) ENGINE = InnoDB; From what I understand, this should fit my requirements. (And parent must default to null to allow insertions, correct?) The problem is, if I change the id of a record, it will not cascade: Cannot delete or update a parent row: a foreign key constraint fails (`iddoc_main`.`fruit`, CONSTRAINT `fk_parent` FOREIGN KEY (`parent`) REFERENCES `fruit` (`id`) ON UPDATE CASCADE) What am I missing? Feel free to correct me if my terminology is screwed up... I'm new to constraints.

    Read the article

  • Is it Possible to Use Constraints on Hierarchical Data in a Self-Referential Table?

    - by pbarney
    Suppose you have the following table, intended to represent hierarchical data: +--------+-------------+ | Field | Type | +--------+-------------+ | id | int(10) | | parent | int(10) | | name | varchar(45) | +--------+-------------+ The table is self-referential in that the parent_id refers to id. So you might have the following data: +----+--------+---------------+ | id | parent | name | +----+--------+---------------+ | 1 | 0 | fruit | | 2 | 0 | vegetable | | 3 | 1 | apple | | 4 | 1 | orange | | 5 | 3 | red delicious | | 6 | 3 | granny smith | | 7 | 3 | gala | +----+--------+---------------+ Using MySQL, I am trying to impose a (self-referential) foreign key constraint upon the data to cascade on update and prevent deletion of a record if it has any "children." So I used the following: CREATE TABLE `test`.`fruit` ( `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `parent` INT(10) UNSIGNED, `name` VARCHAR(45) NOT NULL, PRIMARY KEY (`id`), CONSTRAINT `fk_parent` FOREIGN KEY (`parent`) REFERENCES `fruit` (`id`) ON UPDATE CASCADE ON DELETE RESTRICT ) ENGINE = InnoDB; From what I understand, this should fit my requirements. (And parent must default to null to allow insertions, correct?) The problem is, if I change the id of a record, it will not cascade: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`fruit`, CONSTRAINT `fk_parent` FOREIGN KEY (`parent`) REFERENCES `fruit` (`id`) ON UPDATE CASCADE) What am I missing? Feel free to correct me if my terminology is screwed up... I'm new to constraints.

    Read the article

  • Kinesis Advantage OS X media keys

    - by Patrick O'Doherty
    I recently started using a Kinesis Advantage with my MacBook and one of the things I've really missed since switching from my Apple keyboard is having the functionality of the OS X media keys. I know the Advantage keyboards are pretty customisable but having Googled for quite a while I haven't been able to find any sources saying that it's possible to map the function keys on the Advantage to the appropriate OS X function. Has anyone had any success in getting something like this to work? Any tips would be hugely appreciated.

    Read the article

  • OS X home, end, page up, page down movement keys and cursor focus

    - by Gerald Kaszuba
    When using the home, end, page up and page down movement keys in a text editor, the cursor stays in the same spot, even though the window has moved elsewhere. I know that you can use the option modifier to move the cursor along, but is there a way to move the cursor where your window has moved to (without using the mouse)? Another alternative would be to make these movement keys always behave as if the option modifier key is already pressed. Is this possible?

    Read the article

  • Logitech keboard wrong keys under MAC OSX

    - by David Casillas
    I have a Logitech MK250 keyboard I use with my Macbook. One day the "minor/mayor than" and the "back slash" keys flip their functionality, so I have to hit "backslash" to get a "minor than" symbol and press the "alt + minor than" key to get the "backslash". Is there any way to reverse this annoying behavior? I often switch to Windows, where the keys work the expected way, and I'm always missing the right key.

    Read the article

  • Arrow keys don't work in htop on OS X in Terminal

    - by Daniel Huckstep
    Not sure when it happened, or what I did (if anything), but my arrow keys don't work in htop anymore to scroll around. You should be able to press up and down to scroll up and down the process list, but they don't work. Some keys tend to be the equivalent of 'go back' or something. If I'm on the settings screen, left, up and down all go back to the main screen. htop seems to be the only affected program.

    Read the article

  • Function keys over SSH/PuTTY to SCO unix

    - by CyberKing
    I am trying to set up SSH to a SCO Unix server that runs custom software that uses the function keys on the keyboard, however the keys do not appear to be in the correct format for SCO to recognise. None of the keyboard options on PuTTY work, including the SCO option. How do I change the keycodes that SCO/bash is looking for when it wants a function key? If it helps, the system is upgrading from Wyse50 terminals. thanks!

    Read the article

  • Generating SSH Keys on the Server

    - by mupro
    I have set up sshd on a Linux server and managed to log in via keys generated using ssh-keygen. However, I have made the following observation: When I generate the key pair on the client and copy the public key to the server everythings works fine. But when I generate the key pair on the server and copy the private key to the client I cannot log in. Can anybody explain to me if and why the keys have to be created on the client?

    Read the article

  • disable arrow key on flowplayer scrollable

    - by loo
    i need to disable the arrow keys in a flowplayer.org scrollable i have a text input that i cant move between the letters due to the scroller moving when arrow keys pressed, i dont care to disable the scroller keys permanently. thanks link to scrollable link to forum to disable keys

    Read the article

  • Synergy 1.4.2 Linux server, OSX client, Media/Function key mapping issues

    - by at165dB
    I'm using an Apple bluetooth keybord to control my Linux synergy server. SSH tunneling, Mouse, Keyboard, and Copy&Paste all work. Linux sees all the media/app keys that are on top of the F# keys correctly. However if I press any of those keys while controlling my OSX client, nothing happens on the client. Running synergys with -d DEBUG1 I can see the following keycode info: Pressing the "dim monitor" key that also serves as F1 generates: new mask: 0x2000 event: KeyPress code=232, state=0x0010 new mask: 0x2000 If I press "fn" and the same key, I can see it sending what I'm assuming is an F1: event: KeyPress code=67, state=0x0010 onKeyDown id=61374 mask=0x2000 button=0x0043 send key down to "foo.cisco.com" id=61374, mask=0x2000, button=0x0043 new mask: 0x2000 event: KeyRelease code=67, state=0x0010 onKeyUp id=61374 mask=0x2000 button=0x0043 send key up to "foo.cisco.com" id=61374, mask=0x2000, button=0x0043 I'm guessing I need to tweak my synergy.conf so that the server sends keys that it currently isn't. I'm also not sure what I need to do to tweak the keys that it is sending, but are not working. Below are all the other keys I'm having issues with. Does anyone have any idea how I can enable their functionality? brighten monitor: new mask: 0x2000 event: KeyPress code=233, state=0x0010 new mask: 0x2000 expose: new mask: 0x2000 event: KeyPress code=128, state=0x0010 new mask: 0x2000 dashboard: new mask: 0x2000 event: KeyPress code=212, state=0x0010 new mask: 0x2000 dim keyboard: new mask: 0x2000 event: KeyPress code=237, state=0x0010 new mask: 0x2000 brighten keyboard: new mask: 0x2000 event: KeyPress code=238, state=0x0010 new mask: 0x2000 rewind: event: KeyPress code=173, state=0x0010 onKeyDown id=57521 mask=0x2000 button=0x00ad send key down to "foo.cisco.com" id=57521, mask=0x2000, button=0x00ad new mask: 0x2000 event: KeyRelease code=173, state=0x0010 onKeyUp id=57521 mask=0x2000 button=0x00ad send key up to "foo.cisco.com" id=57521, mask=0x2000, button=0x00ad play/pause: event: KeyPress code=172, state=0x0010 onKeyDown id=57523 mask=0x2000 button=0x00ac send key down to "foo.cisco.com" id=57523, mask=0x2000, button=0x00ac new mask: 0x2000 event: KeyRelease code=172, state=0x0010 onKeyUp id=57523 mask=0x2000 button=0x00ac send key up to "foo.cisco.com" id=57523, mask=0x2000, button=0x00ac fastforward: event: KeyPress code=171, state=0x0010 onKeyDown id=57520 mask=0x2000 button=0x00ab send key down to "foo.cisco.com" id=57520, mask=0x2000, button=0x00ab new mask: 0x2000 event: KeyRelease code=171, state=0x0010 onKeyUp id=57520 mask=0x2000 button=0x00ab send key up to "foo.cisco.com" id=57520, mask=0x2000, button=0x00ab mute: event: KeyPress code=121, state=0x0010 onKeyDown id=57517 mask=0x2000 button=0x0079 send key down to "foo.cisco.com" id=57517, mask=0x2000, button=0x0079 new mask: 0x2000 event: KeyRelease code=121, state=0x0010 onKeyUp id=57517 mask=0x2000 button=0x0079 send key up to "foo.cisco.com" id=57517, mask=0x2000, button=0x0079 volume down: onKeyDown id=57518 mask=0x2000 button=0x007a send key down to "foo.cisco.com" id=57518, mask=0x2000, button=0x007a new mask: 0x2000 event: KeyRelease code=122, state=0x0010 onKeyUp id=57518 mask=0x2000 button=0x007a send key up to "foo.cisco.com" id=57518, mask=0x2000, button=0x007a volume up: event: KeyPress code=123, state=0x0010 onKeyDown id=57519 mask=0x2000 button=0x007b send key down to "foo.cisco.com" id=57519, mask=0x2000, button=0x007b new mask: 0x2000 event: KeyRelease code=123, state=0x0010 onKeyUp id=57519 mask=0x2000 button=0x007b send key up to "foo.cisco.com" id=57519, mask=0x2000, button=0x007b eject: event: KeyPress code=169, state=0x0010 onKeyDown id=57345 mask=0x2000 button=0x00a9 send key down to "foo.cisco.com" id=57345, mask=0x2000, button=0x00a9 new mask: 0x2000 event: KeyRelease code=169, state=0x0010 onKeyUp id=57345 mask=0x2000 button=0x00a9 send key up to "foo.cisco.com" id=57345, mask=0x2000, button=0x00a9

    Read the article

  • Brightness keys adjust brightness too many times

    - by erjiang
    Every time I hit a brightness key on my laptop's keyboard, it adjusts the brightness by three steps instead of one. How can I fix it so that it only adjusts one step at a time? I am using an Acer Aspire D250 with the newest firmware. It was working better when I was using Ubuntu 10.10 with older firmware (although the scale was off). Any tips on debugging this would be appreciated. Edit: My graphics: 00:02.0 VGA compatible controller: Intel Corporation Mobile 945GME Express Integrated Graphics Controller (rev 03) /sys/class/backlight$ ls acpi_video0 intel_backlight

    Read the article

  • The dreaded Brightness issue (Fn keys + Max brightness)

    - by Adam
    I'm trying to get some control over the brightness of my Samsung QX411 (Integrated Intel and discrete Nvidia, though Ubuntu doesn't see the latter yet, I'll play around with Bumblebee later) Using the FN+up/down lowers the screen brightness from max to one peg down or back up. If I try to bring the brightness down any more, it just flickers and stays the same. I can lower the brightness in Settings, but that's delicate and gets reverted to max if I open up the brightness settings again, or log out. The closest I got was adding acpi_backlight=vendor to a line in /etc/default/grub, (source) I could consequently lower the brightness a couple of pegs down to the minimum with FN+down, but then it's as if the problem got inversed, and I'd get stuck in the bottom tier, I could only increase the brightness by one peg and back down. Rebooting would revert to max brightness. acpi_osi=, acpi_osi=Linux, acpi_osi=vendor, acpi_osi='!Windows 2012', acpi_backlight=Linux, acpi_backlight='!Windows 2012' don't do anything for me. I've also tried adding echo 2000 > /sys/class/backlight/intel_backlight/brightness to /etc/rc.local, where my max value from cat /sys/class/backlight/intel_backlight/brightness is 4648, which didn't do anything. (same result with echo 2000 > /sys/class/backlight/acpi_video0/brightness) source Samsung tools also didn't help in this regard. I've spent hours on this, it's getting quite frustrating. Any help would be greatly appreciated.

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >