I have a table (EMAIL) of email addresses: EmailAddress ———— jack@aol.com jill@aol.com tom@aol.com bill@aol.lcom and a table (BLACKLIST) of blacklisted email addresses: EmailAddress ——–…
Tag: database
Index for nullable column
I have an index on a nullable column and I want to select all it’s values like this: In the explain plan I see a FULL TABLE SCAN (even a hint didn’t help) Does use the index… I googled and found out there are no null entries in indexes, thus the first query can’t use the index. My ques…
How to update selected rows with values from a CSV file in Postgres?
I’m using Postgres and would like to make a big update query that would pick up from a CSV file, lets say I got a table that’s got (id, banana, apple). I’d like to run an update that changes the Bananas and not the Apples, each new Banana and their ID would be in a CSV file. I tried looking
How to create trigger in informix?
I am trying to write a trigger like in the following simplified example: This fails! Only this works: What am I doing wrong? Answer I think you should write a stored procedure with the IF – THEN logic and call that from this trigger. I think triggers support only simple SQL statements, not SPL statement…
Function as parameter to another function in Postgres
Can I create a user defined function in Postgres either through the C-Language Function API or by using pl/pgsql which accepts a callback function as parameter? As far as I see there is no way to do this through the C-Language API since it only accepts sql datatypes and there is no datatype for function. But …
Concatenate with NULL values in SQL
Column1 Column2 ——- ——- apple juice water melon banana red berry I have a table which has two columns. Column1 has a group of words and Column2 …
Know relationships between all the tables of database in SQL Server
I wish to all know how the tables in my database are related to each other (i.e PK/FK/UK) and hence i created a database diagram of all my tables in SQL Server. The diagram that was created was not easily readable and had to scroll (horizontally and sometimes vertically) to see the table on the other end. In …
Can all SQL queries be represented in Relational Algebra, Domain and Tuple relational calculus
My query includes a having and count or all in. How are these represented in RA/DRC/TRC? Would I have to simplify my SQL query even more? Here is a simplified example: empl(employee (primary key), …
Some sort of “different auto-increment indexes” per a primary key values
I have got a table which has an id (primary key with auto increment), uid (key refering to users id for example) and something else which for my question won’t matter. I want to make, lets call it, different auto-increment keys on id for each uid entry. So, I will add an entry with uid 10, and the id field
How do I add a custom CHECK constraint on a MySQL table?
I am having trouble with this table I want to have a foreign key constraint, and that works. Then, I also want to add a constraint to the attribute status so it can only take the values ‘a’, ‘d’ and ‘u’. It is not possible for me to set the field as Enum or set. Can anyone …