Skip to content
Advertisement

Tag: database

Auto-increment a primary key in MySql

During the creation of tables using mysql on phpmyadmin, I always find an issue when it comes to primary keys and their auto-increments. When I insert lines into my table. The auto_increment works perfectly adding a value of 1 to each primary key on each new line. But when I delete a line for example a line where the primary

How to make it into BCNF

Good morning, I wonder how I can make sure this schema is in BCNF. petition(ID, title, contents, budget, organizationID, official, resultID, applicantID) applicant(ID, name) official(ID, name, department) organization(ID, name, phoneNumber) *Each petition has an official. *Each petition should have more than one organization. This is the hardest option that I cannot handle. With the same petitionID, there can be several

For all entries in one table, add to another table

Database looks like this: table1 table2 I want to make a query that passes the same data for all ID’s into table2. So after the query the database would look like the following: table1 table2 I’ve tried to make some INNER JOIN queries, but I can’t seem to make it work. Any suggestions? Answer Do you want this? Normally, ids

One to One Mapping Spring boot

Hello everyone in advance I have a problem with my one to one connection when I try to log in to the “user” I get this error what i need is a one to one connection that does not have to be persistent that means a user can have a player but does not have to have it and the

SQLite – Rolling Average/Sum

I have a dataset as shown below, wondering how I can do a rolling average with its current record followed by next two records. Example: lets consider the first record whose total is 3 followed by 4 and 7 ,Now the rolling 3 day average for first record would be 4.6 and so on. Expected output: PS: Having “null” value

How to delete row contain specific string on it in SQL Server

There are lots of rows that contain ’08:28:00.000′ in my table,like this one: I want to delete all the rows that ‘datetime’ contains ’08:28:00.000′.Instead of deleting this kind of rows one by one,is any command can delete all the rows than datetime contain ’08:28:00.000′? Answer Try using a range delete query here, after extracting time from the datetime column:

Advertisement