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 …
Tag: sql
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…
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 …
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…
Combine two statements with LIMITS using UNION
Is there a way to combine these two statements into one without having duplicate entries? My first, obvious attempt is not supported by SQLITE (Syntax error: Limit clause should come after UNION not before): Answer Use subqueries and perform the limit within them.
Counting number of records hour by hour between two dates in oracle
I need a SINGLE query that does this sequence in oracle. As you see the hour is increasing one by one. here is the output I have written a query but it does not give me the right answer! this query gives me a result set that sum of it’s count(*) is equal to the first query written above! here
SQL Server – copy stored procedures from one db to another
I am new to SQL, and what I needed to do was to combine 2 .mdf databases into one. I did that using SQL Server 2008 Manager – Tasks > Import/Export tables.The tables and views were copied successfully, but there are no Stored procedures in the new database. Is there any way to do that? Answer Right c…