mysql-table

MySQL field management

When I make a query, I often wonder about this: Is it better to add extra field(s) to the table, or just get the values and calculate in your server side language? For example, table Student contains Student.score field. I want to get the grades. Do I get the score and make a bunch of if/else/switch for the grades? ...

Mysql DB Table Rows Disappearing

Hello, A really weird (for me) problem is occurring lately. In an application that accepts user submitted data the following occurs at random: Rows from the Database Table where the user submitted data is stored are disappearing. Please note that there is NO DELETE, DROP, TRUNCATE or other SQL statement issued on the database table ex...

How to add 1 to the value of a column of an existing row in mysql

Hello everyone, I have a table called pollData. It will always contain only 1 row. It has columns option1, option2, option3, option4, option5 each of type int. In the beginning, these columns have 0 as their value. How do I add 1 to any column, say option2? I mean do i retrieve the value of that column first, perform addition, and store...

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 ...

Stupid Question: MSSQL Management Studio 2008 - Database Diagrams - Which way do the keys point?

Yeah silly question. Its been a long time since I have designed a DB as a Database Diagram but the higher ups want to see it. I have totally become confused because I am a coder, not a DBA. I have a main table which contains user id, name, username, password, etc. This main table has the primary key of ID. Should sub tables (such as add...