Skip to content

Tag: database

How to round this in SQL

we just started our studying on SQL and I seem to have a slight problem with one exercise. I would need to round the result of I was trying to do it with subquery but I just did not hit the correct one even tough similar subqueries with only select seem to work well. Any help? Answer Use ROUND

Export data from a non-normalized database

I need to export data from a non-normalized database where there are multiple columns to a new normalized database. One example is the Products table, which has 30 boolean columns (ValidSize1, ValidSize2 ecc…) and every record has a foreign key which points to a Sizes table where there are 30 columns wi…

Select updated rows in mysql

Is there simple way to select updated rows? I’m trying to store timestamp each time I am read row to be able to delete data that was not readed for a long time. First I tried execute SELECT query first and even found little bit slow but simple solution like but I still want to find a normal way to

make text column as unique key

i want to make a table in MySQL server with mediumtext column as UNIQUE KEY but this made an error when I change the type of `name` to varchar .. it works! can you tell if i can to make text column as UNIQUE KEY Answer Basically you can not use Text column as UNIQUE key. Because practically such a

Inserting NULL into MySQL timestamp

I’m observing unexpected behavior with inserting/updating NULL in a MySQL timestamp column. Consider the following statements. The first insert (when hiredate is not specified in the SQL, hireDate is null(0) which is expected. However when an explicit null passed in SQL, the current date time is inserte…