table: the id 11 has both taught in classroom 11A, 11B. How to select the ids that have both values 11a,11b? I tried this with no luck: because it gives empty table, because it can’t be both 11a and b at the same time. Answer If it’s exectly two values you can make an inner join
Creating a table where UserPassword not equal to UserName, but the following code returning a error
In SQL Server: I get this error: Column check constraint for column ‘UserPassword’ references another column, table (Credentials). Answer You are defining column level constraints, In a column level constraint, you can only define constraint for specific column. For your requirement, you should go for table level constraints, from this you can define constraint for multiple columns, like:
How can I assign pre-determined codes (1,2,3, etc,) to a JSON-type column in PostgreSQL?
I’m extracting a table of 2000+ rows which are park details. One of the columns is JSON type. Image of the table We have about 15 attributes like this and we also have a documentation of pre-determined codes assigned to each attribute. Each row in the extracted table has a different set of attributes that you can see in the
updating postgres table with unique Integer array
I am not so good in queries. I have a table with column users which is of type ‘users integer ARRAY’. For e.g. it looks like users[1,2] Now I want to update this array with new value, but it has to be distinct. For e.g. if I want to add 3 to it then the output should be users[1,2,3] and
How can I calculate an “active users” aggregation from an activity log in SQL?
In PostgreSQL, I have a table that logs activity for all users, with an account ID and a timestamp field: A single account_id can appear many times in a day, or not at all. I would like a chart showing the number of “active users” each day, where “active users” means “users who have done any activity within the previous
get the scheduling data based on 3 years in mysql
I have one table bibles that having two columns only i.e. is below:- Bible Scheduling starts from 5 sept 2021 for 3 years and ends on 31 Aug 2024 i.e basically bible repeats three time in 3 years. Now Suppose today date is 8 Sept 2021 So now requested date is 8 spet 2021 i want to fetch the 4th
Calculating timestamp difference in seconds in BQ
I am trying to calculate the timestamp difference between install_time and attributed_time, in seconds. However, I keep receiving this error: No matching signature for function TIMESTAMP_DIFF for argument types: TIMESTAMP, STRING, DATE_TIME_PART. Supported signature: TIMESTAMP_DIFF(TIMESTAMP, TIMESTAMP, DATE_TIME_PART) at [10:3] My sample data and query are below. Sample data Attributed_time install_time user_id 2021-02-20 18:42:31 2021-02-20 18:55:06 UTC A 2021-02-20 11:10:53 2021-02-20
Where In SQL Oracle
I have one question, I am trying to make one WHERE statement in Oracle SQL. As result for the TARGET_ADDRESS column, I need the value from this column only if ENTRY_POINT = +322012345, otherwise it should be null. table data Is it possible? It’s possible to used CASE but I want keep my column TARGET_ADDRESS. Answer If I understand correctly,
I would need to split only specific strings to numbers and then maximize these numbers from the specific strings in Google sheets?
Example of my google sheet spreadsheet cells below 1 AAA C1 BBB C4 AAA C7 A1: “AAA C1” B1: “BBB C4” C1: “AAA C7” I would need to maximize the highest numbers after the …
How to check for clustered unique key while inserting in SQL table
I am trying to insert rows from another database table to new database table getting the below error if there is no where condition in the query. Violation of UNIQUE KEY constraint ‘NK_LkupxViolations’. Cannot insert duplicate key in object ‘dbo.LkupxViolation’. The duplicate key value is (00000000-0000-0000-0000-000000000000, (Not Specified)). Then I wrote the below query adding where conditions it worked but