I deployed azure MySQL 5.7 database in azure. I can’t create another admin user with admin permission with the serveradmin login. When I tried below command GRANT ALL PRIVILEGES ON . TO ‘sammy’@’localhost’ WITH GRANT OPTION; I am getting error serveradmin@ip don’t have enough permissions even though I am user server admin login. Is this because of Microsoft Azure database
Tag: sql
Generate rows to fill in gaps between years, carry over a value from previous year
I have a table of road condition ratings (roads are rated from 1-20; 20 being good). db<>fiddle In a query, for each road, I want to generate rows to fill in the gaps between the years. For a given road, starting at the first row (the earliest inspection), there should be consecutive rows for each year all the way to
How to append nested key-value to json array in postgresql?
My json values in jsonb column are below: I have nested key – “Images” that has array of strings. How to write query that will add to Images new keys/values (“UploadedBy”:null and “Size”:null) and transform array of string to key-value (“https://face.png” -> “Link”:”https://face.png”) like below: Answer You can use jsonb_set: See fiddle.
How can I pass a stored procedure parameter into a cursor in snowflake?
I am currently trying to pass a parameter into a stored procedure and use this parameter when creating a cursor unsuccessfully. Here is a simplified snippet of the code I currently have for creating the stored procedure: I then call the stored procedure using: However, when this stored procedure is run, it just runs the string ‘ ||:TABLE2PROFILE|| ‘ without
how to get the sql data in reverse order of rows
i have a source table desired result output— i was trying something like this is this is a simple way to write or any better ways to write ? Answer We can use CASE expressions to find each distinct source destination pair:
How to get the SQL result in reverse from the columns in SQL
I have been asked a question in an interview. Sample table named test: Desired output: How to to get the desired output? Answer You just need to use order by on column B ASC|DESC
SQL: Capturing first row in WHILE loop
I’m thinking my issue is based on how I’ve written the loop, but how it is written is how I’ve come to understand loops. So I’m really wondering if there is a way to consolidate this? As it sits, I have 2 sections: the first which captures the very first row, and it exists solely because my second section will
Create a new double-field based on the existing string-filed
There is an SQL query forming a table. It is necessary to form another double-number field based on one of the string fields in the table. Values of the original string field (BRLOADSTA0): Values of the resulting double-field (BRLOADSTA9): The request which I’ve create: Full snippet: Thanks in advance even for trying to help 🙂 Answer Could you tell us
Postgres Query Using Join Table
I have 3 tables: users, public_pictures, pictures Import properties: users.id public_pictures.user_id public_pictures.picture_id pictures.id public_pictures is a join table between users and pictures with only those two properties above. Both are foreign keys to their respective table. Given a user.id, I want to get all their public pictures. I tried something like: but this just returns all the user’s images instead
Re: MySQL 8.0 Command Line Client Error 1205
MySQL 8.0 Command Line Client is giving me a timeout error and I have restarting the transaction by typing “start transaction” another time. Keep in mind that I have another command line open with the table CIA_DATA.new_table and it is also being updated with the same changes. (I am doing this to follow a tutorial.) Here is the script: Updated