I have a table named datas and I’m executing a query like this: SELECT linkurl AS DOWNLOADURL, lastrevlevel AS VERSION, code AS DESCRIPTION, created AS RELEASEDATE, name …
Firebird SQL Statement to Get the Table Definition
I am writing my own Firebird database browser using the ibpp library. Is there a way I can get the table definition using an SQL statement? Answer Firebird does not support schemas, so there is no way you can get that information. The closest thing might be the owner, which you can get by querying RDB$RELATIO…
How to get time difference (in hours) between 2 dates
I am trying to get the time difference between 2 users, I need the difference in hours. I tried to use DATEDIFF function but it’s wrong. Here is my code: SELECT DATEDIFF(*, (SELECT max(u1.time_c) …
Delete statement in SQL is very slow
I have statements like this that are timing out: I tried doing one at a time like this: and so far it’s at 22 minutes and still going. The table has 260,000 rows in it and is four columns. Does anyone have any ideas why this would be so slow and how to speed it up? I do have a
Duplicate Rows on SQL Join
When I do a left join on a table it duplicates the results from the left table when more values are found in the right table. How can I only return the distinct values from the left even when there are multiple values on the right table. (return only the one movie even when there are multiple images on the
Difference between count(attribute) and count (*) using group by
I haven’t understood the difference between count(*) and count having an attribute as argument. Here I make an example: there are two relationships: With employee_ssn which references employee(ssn) and project_id referencing project(id). Primary keys: project(id), employee(ssn), working_on (employee_ssn…
How to convert all tables in database to one collation?
I’m getting error: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation ‘=’” I tried changing both tables manually to utf8_general_ci,IMPLICIT but I’m still getting the error. Is there a way to convert all tables to utf8_general_ci,IMPLICIT …
Why aren’t my triggers firing during an insert by SSIS?
I have an SSIS data flow task with an OLE DB Destination component that inserts records into a table with a trigger. When I execute a normal INSERT statement against this table, the trigger fires. …
Oracle insert from select into table with more columns
I want to insert to a table from a select statement, however, there are 3 columns returned from the select statement and the table has 4 columns, I would like to add 0 for all rows in the extra column….
SQL query, where = value of another table
I want to make a query that simply makes this, this may sound really dumb but i made a lot of research and couldn’t understand nothing. Imagine that i have two tables (table1 and table2) and two columns (table1.column1 and table2.column2). What i want to make is basically this: I don’t know if thi…