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 …
Superkey, candidate key & primary key
Can any kind soul clarify my doubts with a simple example below and identify the superkey, candidate key and primary key? I know there are a lot of posts and websites out there explaining the differences between them. But it looks like all are generic definitions. Example: So from the above example, I can kno…
How can I improve my Classic VBA coding using SQL? I’m making a mess with loops
Well… I am a n00b, I know that. And this is pretty straight foward. Basically this is the code I’ve been writing. rstSwift.MoveFirst Do While Not rstSwift.EOF If Left(rstSwift!Date, 2) & …
Best way to delete millions of rows by ID
I need to delete about 2 million rows from my PG database. I have a list of IDs that I need to delete. However, any way I try to do this is taking days. I tried putting them in a table and doing it in batches of 100. 4 days later, this is still running with only 297268 rows deleted.
Oracle Count even if nothing is there
So i have this query: It will return stuff from place and then d is another table describes. It will get the number of reviews the place has and the average rating. This works perfectly fine as long as there is something in the describes table. How can i go about getting the stuff that does not have anything …
Create unique constraint with null columns
I have a table with this layout: CREATE TABLE Favorites ( FavoriteId uuid NOT NULL PRIMARY KEY, UserId uuid NOT NULL, RecipeId uuid NOT NULL, MenuId uuid ) I want to create a unique …
Show MySQL host via SQL Command
Show Database Use database show tables Describe
All good and well, but is it possible to show the current connections host. Not connection_id, but the IP Address or Name of the host.
Carriage return symbol is removed from XML using OPENXML
It looks like SQL Server removes r characters when parsing XML. So when my stored procedure receives values in xml for saving, all line breaks are represented as n instead of rn. Is there any way …
How can I prevent inserting duplicate data into a SQL Server table?
I have a series of data that need to be written into SQL, what should I do to check the data in SQL to prevent same data inserted into table? Example data to be inserted: David James John If …
SQL. Average entries per month
I have some abstract entry in DB and it’s creation date. How can I get average entries created per month? Edit: Table has Name field and CreationDate field.