I wrote a sql query to update data of ‘tbl_products’. Here is the query update tbl_products set product_count = (product_count – tbl_order_details.product_sales_quantity) from tbl_products join …
Tag: mysql
Store procedures for delete a repeat records
Hello i have a table in MySQL: “contracts” where i create a 3 record’s for each client_id, but one bug in the backend create more records on some client_id i try create a store procedure to …
Merge two tables in one SQL query and make the date values unique
I have the following two tables which you can also find in the SQL fiddle here: CREATE TABLE Inbound ( Inbound_Date DATE, Product TEXT, InboundType TEXT, Quantity VARCHAR(255) ); …
One column in a table referring to another column where there are duplicate data in SQL
I want to build simple database system about bike (or bicycle) rental store. Here are the tables, and columns in parantheses: (MNr stands for model number, CNr stands for customer number). Models are bike models, Bike table shows data on each particular bike. There can be several bikes of each model, to disti…
Spring JPA – Prepared Statement Queries?
I’m building a Spring REST server application and I’m doing some native queries to retrieve data from my database. From the teaching in school, they suggest to make all queries prepared statements, to stop the user entering harmful SQL into the input boxes. I’ve tried to do some research, bu…
MySql Select Statement (Other Company)
I am trying to select distinct users that are listed for other companies but not on my company (1). Here is an example From this table, I would like to get row 4 since he is in other company (not 1) but listed on others. I do not want others because they are listed on both my company and others.
convert full date string to date mysql
I have database which contains string like this 22 Jan 2019 11:03 I would like to convert this string to date so I apply this query select DATE_FORMAT(STR_TO_DATE(’22 Jan 2019 11:03′,’%d-%m-%Y’…
SQL Query: get the date and customerid of the most expensive order placed
Can someone help me with a mySQL query? My data is: | OrderID | ItemPrice | |———|———–| | 1 | 2500 | | 2 | 500 | | OrderID | CustomerID | OrderDate | |———|…
how to fetch top 9 and others based on count(entity_id) sorted highest top 9 and then club the other count into ‘others’ category
The following query executes everything: SELECT count(entity_id), cim.institute_id, cfi.name_ FROM ci_certification_students cis INNER JOIN ci_certification_master cim ON cis.certificate_id = cim….
MySQL query or procedure to return table from values computed over multiple rows
I have a network created MYSQL table with following fields: IP_SRC, IP_DST, BYTES_IN, BYTES_OUT, START_TIME, STOP_TIME 1.1.1.1 8.8.8.8 1080 540 1580684018 1580684100 8.8.4.4 1.1.1.1 2000 …