I’m new to Firebird and I’m testing a few things to check out the differences between Fb and SQlite (and the .net driver). I am trying to do a drop table if exists followed by the creation of a table. In Sqlite I am able to do this by: However in Firebird the same query fails. I’ve read that this
Tag: sql
Recursive Subquerying with sorting
I looked at Tim Hall’s excellent article here, that allows you to work with self-referenced entities and show hierarchical data (starting with top level nodes and joining back recursively), using CTE like syntax in Oracle. So I have code that looks like this: For the the anchor rows (the top level hierarchy J1 entries in my SQL, with NULL parents),
Can I programmatically exit a Firebird script
Consider the following script: The exit is perfectly valid and does cause script execution to end. At least in IBExpert where I am testing this. But I want to do this programmatically. Is the exit in my first example valid Firebird or is IBExpert handling this itself? Is there a different way to exit the entire script conditionally? Answer You
Rolling 90 days active users in BigQuery, improving preformance (DAU/MAU/WAU)
I’m trying to get the number of unique events on a specific date, rolling 90/30/7 days back. I’ve got this working on a limited number of rows with the query bellow but for large data sets I get …
MERGE table, do nothing when matched
I have a table DOMAINS in 2 different schemas with columns ID, NAME,CODE,DESCRIPTION. For any NAME exist in new schema, it should use existing ID without any merge; for those new NAME records, it should insert with ID from old schema. How can i intepret the portion of do nothing in above query? Answer For your case, no need to
Saving a pem certificate in a SQL Server database
I need to save the content of a *.PEM certificate in a SQL Server database. I plan to save it in a nvarchar() column, but I’m not sure what length should I use. I would appreciate any advice. If you have experience with saving pem files to a relational database that would be even better. Answer There is no upper
Adding a new column with data
Below is my table: Now I want to add a new column called ‘Gender’ with values M,M,M,F in 4 rows respectively. I first added a new column using: Now I understand I can add data one by one by using: But how do I add all 4 data at once? Answer You don’t, unless there is some other piece of
How can i use Flyway migration with single schema and multiple projects
How to manage multiple projects dealing with the same DB schema. The Flyway migration scripts in each of the project does not allow to start if it is modified by the other project. For example: I have a spring boot Project X with a FlywayInitializer class. And i have a submodule Project Y with also his own FlywayInitializer class Project
MySQL script triggers Error #1241
I have the script below, which is supposed to get a price for an array of ID’s that has been provided. But it needs to get 1 price per ID, and the tricky part is, that I want to have the ability to have scheduled price updates. This mean that it needs to take the price that is <= UTC_TIMESTAMP
Avoid duplicates in postgreSQL
I’m using postgreSQL version 10.3 and I have a table like this: I want to make numerous INSERT and make sure there are no duplicates. So I thought about using INSERT INTO … ON CONFLICT DO NOTHING;. The idea is to insert the record only if the values on the columns first | second | third | fourth | fifth