I have ‘a unique-id’. I want to fetch records from table on basis of that unique-id. I have a column named “request body” that contains a nested json string which is of type text. Is there any way i can compare ‘unique-id’ with the ‘unique-id’ inside the json st…
MS Access SQL query – Count records until value is met
I have an Access query (qr1) that returns the following data: dateField stringField1 stringField2 booleanField 11/09/20 17:15 John Nick 0 12/09/20 17:00 John Mary -1 13/09/20 17:30 Ann John 0 13/09/20 19:30 Kate Alan 0 19/09/20 19:30 Ann Missy 0 20/09/20 17:15 Jim George 0 20/09/20 19:30 John Nick 0 27/09/20 …
What are the downsides of making a numeric column a string in a database?
I have members on my team who are tossing around the idea to make every column in the database a string including numeric columns. I know that sorting becomes an issue. What are the other downsides of making a numeric column a string? Answer The major issue is that users can put broken data into the columns &…
Percentage increase/decrease reading 9% as 90% when putting it in descending order
I created a new column called ‘Percentage’ that calculates the percentage increase between Expected and Actual payment. The calculation seems right but when I put it in descending order, 9% is right below 90% when 9% should be at the bottom of the list. In addition to this, i’d like to remov…
How can I make my sql trigger about inappropiate words work
I have a database with different tables in order to store photos, users, reviews, ratings… I wanna validate that no one uses “bad words” (insults) in their photos’ title or description. So I decided to create a table called ‘inappropiatewords’ where all of these bad words w…
How to terminate SQL statements when using DEFAULT value and OleDB?
Using C# and the JET OleDB driver (Microsoft.Jet.OLEDB.4.0) to connect to an old Access database (think Access 97). The following SQL statements work fine: But terminating the statement with a semi-colon (;) causes problems: Can SQL statements with DEFAULT be terminated? Answer Default values can (and probabl…
Poweshell retrieve sql query result
I am quite new to PowerShell. I have multiple SQL queries which I am executing from a PS script using SQL adapter. I need to retrieve the common results based on a column from the queries without changing existing queries or writing another one. How to achieve this with PowerShell using the results stored in …
Calculate the number of users based on the below conditions by writing a single query SQL
There are two campaigns running campaign A and Campaign B and list of user ids participated in those two campaign is given below. I am not able to figure out how to write in single SQL query.
‘WITH’ clause does not work with in operator
I have a simple query: It should create a MaxSal temporary table and then in the WHERE section it should check whether the Salary, DepId are inside said table. Unfortunately, this query gives me ORA-00920: invalid relational operator which I guess is referring to the in operator. If I put the Sub-query direct…
What is mean name after variable name in t-sql
I have the next query: Сan you please explain what it means instruction: Is a variable called startdate assigned a different name? But why? Answer First, I would write this as: The two are equivalent, but this is clearer in intent (and less likely to cause problems). In any case, @startdate is not a valid col…