I am working on a library system. I have a book table in which there are 12 columns including author, title, publication etc. Among those 12 there are 2 columns book_id and isbn that are unique. When a library get n copies of a same book the only columns that are going to be unique are book_id and isbn. All
Tag: database
Monitor the activity of a table (number of select on a specific row)
I have a large dataset Table: id | info1 | info2 | … There are multiples process accessing the data heavily. Is there a built-in way in postgresql or an extension to know the number of time a row is accessed with SELECT ? I was thinking of making a stored procedure and manually manage it. Answer No, there is
PL/SQL No data found even there should be?
I’m currently learning PL/SQL atm and I have run into an issue with one of my homework questions. In the below code, I’m getting user input for a province and isolating select results using said province in the declaration of the cursor and trying to run the visitsandtotal procedure but all I’m getting is no data found, why? user prompt
“From is not valid at this position” this is the syntax error I am getting while using Update join in mysql-Workbench
enter image description hereI want to update the Paid column in Product when payment amount get inserted with respect to the product… create table Product( PID INT primary key, Paid int not null …
MySQL – Slow query
Sorry for the long post, but the tables involved are quite big. When I run the query bellow it normally takes about 1m to run. However, when I remove the correlated sub-query I get the query down to 15 seconds. So I think that’s the actual problem. Problem is, I don’t really know how to get the SUM results without
Query that will select a timeframe from specific date to today
I’m having issues in my WHERE clause selecting data from a specific day to today’s date. The day/time format in my date column is ‘7/2/2020 3:12:08 PM’. I’ve tested a couple options but keep getting this error – ‘literal does not match format string’. Any idea’s of how I can select all data from March 1, 2020 to current date?
Increment a column value of an entity in an SQL table
I’ve set up the following table: CREATE TABLE transactions (txn_id SERIAL, stock VARCHAR NOT NULL, qty INT NOT NULL, user_id INT NOT NULL); On inserting few rows, the table looks like this: txn_id | …
Is there a way to enforce the MySQL CHECK constraint for calculated value
Apologies if my wording is very awkward/non-fitting for a programmer – I’m just a SQL noob who’s taking a beginners’ class. I’m using PHPMyAdmin to design an e-commerce database in which the minimum age of a customer is 18 yo. Because age is a calculated column, I want to record the DOB and enforce a CHECK constraint. I tried this
How to search in a SQL database table
I have a table with the following columns: user_id user_name user_unit user_last_name user_first_name user_email I want to write a query that the user declares a string that contains a word/part of a word/user_name/user_id/full name/ext. and the query returns all rows the contains the string, sorted by most relevant. Any offers? Answer You can concatenate the columns together and use like:
Laravel Eloquent – Get data from 3 tables with consecutive foreign keys
I’m looking for a way to join 3 Data Tables. Laravel Query; How to fetch data from table ‘c’ by applying a query on table ‘a’? i’m new to Laravel. Answer Basically, it is not as much related to laravel it needs knowledge of the database. You can join 3 tables like this.