We have a varchar column in a table, that we need to upgrade to enum type. All the values in the varchar column are valid values in the enumeration. There is no null values in the varchar column. …
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
MYSQL How do I Select all emails from a table but limit number of emails with the same domain
As the topic sugests I want to select all emails in the list. But limit the number of emails with the same domain. Lets say i have 500 gmail adressses. And 2 example.com adresses. .. and so on.. …
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…
Relationship of Primary Key and Clustered Index
Can a TABLE have a primary key without a clustered index? And can a TABLE have a clustered index without having a primary key? Can anybody briefly tell me the relationship between primary key and …
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
Bulk load: An unexpected end of file was encountered in the data file
I am using SQL Server Express 2008 When I’m trying load data from txt file in to this table create table Clients ( ClientID int not null IDENTITY (9000,1), LastName varchar (30)not null, FirsName …
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…
Why database designers do not make IDENTITY columns start from the min value rather than 1?
As we know, In Sql Server, The IDENTITY (n,m) means that the values will start from n, and the increment value is m, but I noticed that all database designers make Identity columns as IDENTITY(1,1) , …