table-structure

Storing SAS data (including table structure) in a single flat file

I need to convert SAS data tables into flat files (or "ASCII files" as they were called once, as opposed to binary files). And only 1 flat file for each original SAS table. The challenging thing is that I want the flat file to contain some structural information of the original SAS table also, specifically: Variable/Column name Variabl...

MySQL Row Format: Difference between fixed and dynamic?

MySQL specifies the row format of a table as either fixed or dynamic, depending on the column data types. If a table has a variable-length column data type, such as TEXT or VARCHAR, the row format is dynamic; otherwise, it's fixed. My question is, what's the difference between the two row formats? Is one more efficient than the other? ...

One To Many To Itself

How would one structure a table for an entity that can have a one to many relationship to itself? Specifically, I'm working on an app to track animal breeding. Each animal has an ID; it's also got a sire ID and a dame ID. So it's possible to have a one to many from the sire or dame to its offspring. I would be inclined to something l...

How do I check if a column exists in SQL Server?

How do I check if a column exists in SQL Server 2000? ...

How do I know if CONSTRAINT_NAME is a Primary or Foreign Key?

Using this SQL on SQL Server 2005 SELECT CONSTRAINT_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = @TableName AND COLUMN_NAME=@ColumnName I get the Primary Keys AND the Foreign Keys. How can I get only Foreign Keys? How can I see if a Constraint is a Primary or a Foreign Key? Thanks ...

How do I implement threaded comments?

I am developing a web application that can support threaded comments. I need the ability to rearrange the comments based on the number of votes received. (Identical to how threaded comments work in reddit) I would love to hear the inputs from the SO community on how to do it. How should I design the comments table? Here is the structur...

What changes do I need for my tables to work on AppEngine's BigTable?

Let's say I have a booking database consisting of users: user_id fname lname and their tickets ticket_id user_id flight_no and associated flights flight_no airline departure_time arrival_time What would I need to change to move this Google AppEngine? I understand AppEngine doesn't allow joins. Does that mean my table should be...

"Rebuttals" and "Comments" - Two DB-Tables or One?

I'm working on a project for a friend and I've come across a difficult decision. The project consists of essays, each of which can be challenged, and also commented on. The thing is this, only one person is able to challenge the essay, and then everybody else is locked out and can only comment. The rebuttals can only be two responses de...

How to make tasks double-checked (the way how to store it in the DB)?

Hello all! I have a DB that stores different types of tasks and more items in different tables. In many of these tables (that their structure is different) I need a way to do it that the item has to be double-checked, meaning that the item can't be 'saved' (I mean of course it will be saved) before someone else goes in the program and c...

Table structure for menus in mySQL

I need advices for a table structure. I need to create menus dynamically. There will be more than 3 menus. Some of menus will have multi-level structures. What is the best way to strucure the menu tables? All the menus are in one table Each table should have one table Any other?? Please give me your experience or common practices...

MySQL - Structure for Permissions to Objects

What would be an ideal structure for users > permissions of objects. I've seen many related posts for general permissions, or what sections a user can access, which consists of a users, userGroups and userGroupRelations or something of that nature. In my system there are many different objects that can get created, and each one has to ...

MySQL - Best method to handle this hierarchical data?

This is a followup to: http://stackoverflow.com/questions/3073614/mysql-is-it-possible-to-get-all-sub-items-in-a-hierarchy I have an arbitrary-depth adjacency list model table (I am at the point that I can convert it into a nested set model. I read the MySQL data on how to use a nested set model, though it seemed to get increasingly co...