When using a single insert statement to add multiple records into a table as shown below, it does not follow the same order when selecting. I understand that it does not affect anything but may I know …
Tag: sql
Designing a database for Large Data and Multiple Users [closed]
I am designing a project that can require thousands of records per Admin(I estimate within a couple years I will see over 100,000 records in the database) and all records are unique to each Admin. (ie …
Query Optimization – To repeat a pattern in Oracle SQL
Introduction: I can do this in MS-Excel, it takes me 1 minute, but I m trying to get this in Oracle SQL Here is my Code: SELECT A.*, (CASE WHEN A.r = 1 then ‘X1’ when A.r = 2 then ‘X2’ when A.r = 3 …
Multiple columns from one column
I track the aging of customer invoices. The below code example returns the balance of customer invoices by customer that are between 0 and 30 days old. However, I want to run one query that pulls separate columns into Excel for each customer’s balance aged between 0 and 30 days, 31 and 60, 61 and 90, an…
From sqlite syntax to mysql syntax
I’m having some troubles moving from sqlite syntax to mysql syntax. Does anybody know a ressource showing the basic syntax in sqlite and its equivalent in mysql ? In my particular case, I want to transform this sqlite code into mysql one: For the moment, I did that: DROP TABLE IF EXISTS post; But I got …
SQL Insert JSON into table column
while searching for a way to insert array into single db columns, I found an article about inserting JSON string. However it wasn’t explained how. I tried to search and find the way with no success. I have the following table: What i want to do is insert a Json arry in the address column. like: I though…
subquery shows more that one row group by
I am trying to get the data for the best 5 customers in a railway reservation system. To get that, I tried getting the max value by summing up their fare every time they make a reservation. Here is the code. this throws the error:[21000][1242] Subquery returns more than 1 row If I remove the group by from the…
It is possible to use git as sql database [closed]
I know it’s not logical question,but if git is best solution for code save and work around with team and its use for many things. So why not its use like sql database. Or just store small amount of …
declare variable with pd.read_sql_query
Can someone explain why do I get an error when executing the following simple query with pandas: import pyodbc import pandas as pd connstr = ‘Driver={SQL Server}; Server=sr1; Database=db’ conn = …
please find the solution of this problem. ( in PL SQL ) ——–
I’m doing an assignment and the last question states that I call the procedure from question 2 and function from question 3 and then put them in an insert clause(question 4). Write a PL/SQL Code for an anonymous block to do the following (in package): a) Get the doctor name for a given doctor id (read f…