Can I restore my SQL Server database to a point before the last full backup with my current backup strategy?

If I have this backup strategy(weekly full backup and 1 hour log backup), can I restore the database to the green highlighted period of time? Btw, does log backup 2 includes all log records that have their lsn great than the last_lsn of log backup 1?

enter image description here

azure ad – Access Denied error After migrate on-prem Local AD SP Database to Sharepoint Farm joined to AzureAD DS

I have migrated Sharepoint 2013 Farm which is joined to Local AD DS to Sharepoint 2016 Farm joined to AzureAD DS.

Client wants to take full use of AzureAD DS and want to migrate sharepoint farm to Azure VMs connected to AzureAD DS.

I created a Sharepoint 2016 farm. created normal webapp/Site collection and is able to access as expected.

When I attach sharepoint 2013 DB after upgrade it gives access denied to those upgrade web app.
Do I need to do any changes to existing usernames as they has been now talking to AzureAD DS instead of Local AD.

database design – Best practices when designing SQL DB with “redundant” tables

I have a design dilemma for a DB I’m creating for an e-commerce platform I want to develop.

I have 3 different actors interacting with the website:

  • Customer
  • Manager
  • Supplier

Those 3 actors have the same table structure: email, username, address…

My initial design for the DB was to create a single table (StoreUser), with an additional field to distinguish between the 3 different types of actors.

The issue I see with this design is that when referencing a Customer in the “Order” table for instance, to assign an Order to a Customer, it would be technically possible to assign a “Manager” or a “Supplier” to the order, even though it isn’t wanted. Same thing for the “Product” table, to which a Supplier’s foreign key should be provided, the “StoreUser” FK would not distinguish between the 3 actors.

On the other hand, creating 3 tables, containing the exact same datafields, seems really redundant, especially from the code perspective (I’m using Django for the website, and I really don’t like the idea of having 3 different classes with the same structure.

Which one seems the most logical to you? What’s the good practice here?

Simple database front-end for simple small business

I run a small language school and I have a database with language students’ details: names, contact details, ages, lesson times, dob, fees, fee due dates and the like.

I set up a MySQL online database years ago, wrote php/html pages (from a book) and uploaded them to the server. I use these to input/edit student details, move leavers to another table (I realise now that isn’t necessary), get various lists (next month’s birthdays, fees, lesson registers, etc.) and show reports such as fees due each month, students graduating their normal schools next April, etc. It also archives student numbers according to their school grades at the end of each month (which is the 3rd table in my set-up).
SEMrush

So basically the equivalent of spreadsheets with various reports available at the click of a button.

However, the latest PHP update has me giving up trying to learn how to update all those files and I’m resigned to letting it all go once my hosting company switch off the current PHP version. So I’m looking for a simple front-end that I can use to replace this. I looked at LibreOffice Base and it just seems overkill and a time sink for what I want. I was suicidal after getting through the first chapter of the manual. I’m busy running the school and don’t have the time, intelligence nor inclination to be a programmer, too…

So does anyone have any suggestions what my best plan of action would be? Two of us use the db, not always in the same place, so I want to continue with everything online. Oh, and we use Macs.

 

database design – Getting sums of multiple leveled relations efficiently

I’m currently building an API and a web app for an internal warehouse system using NET Core.
I have the core entity structure, that goes like this:

“Material” has many “MaterialSubtypes” has many “MaterialClasses” has many “Packs”.

Now, I need to create a list, representing a single sale. It can include lots of packs of different materials. The user should be able to add or remove packs to a sale as it is being prepared.
The problem is that I also need to show the user the list of all materials hierarchy that the sale contains, as well as the sum of “Quantity” field of all packs on each sublevel. This quantity is supposed to be updated dynamically in a client app.

What is the most efficient way to do this? Should I just add all packs to a sale, and then, on every GET request, Include everything and recalculate all sums via foreach loops? Or should I create separate entities for Material->MaterialSubtype->MaterialClass within the Sale and update them each time a Pack is added?
None of that seems optimal, but I can’t think of anything else.

Normalization of database tables. Spring DATA JPA Hibernate

I created the table as stated in the hibernate Bidirectional @ManyToMany documentation. I did exactly the same as shown.

When I add a person, I get the following table:

enter image description here

If you look closely, you will notice that there is a violation of one of the main principles of normalization, that is, information redundancy. Repeats several times New York and Los Angeles

How to add a person correctly so as not to violate the normalization of the database tables, so that there is no data redundancy?

enter image description here

Person.java

    @Entity(name = "Person")
    public class Person {

        @Id
        @GeneratedValue
        private Long id;

        private String name;

        @ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
        private List<Address> addresses = new ArrayList<>();

        public Person() {
        }

        public Person(String name) {
            this.name = name;
        }

        // Getters and setters are omitted for brevity

        public void addAddress(Address address) {
            addresses.add( address );
            address.getOwners().add( this );
        }

        public void removeAddress(Address address) {
            addresses.remove( address );
            address.getOwners().remove( this );
        }
    }

Address.java

    @Entity(name = "Address")
    public class Address {

        @Id
        @GeneratedValue
        private Long id;

        private String street;

        @ManyToMany(mappedBy = "addresses")
        private List<Person> owners = new ArrayList<>();

        public Address() {
        }

        public Address(String street) {
            this.street = street;
        }

        // Getters and setters are omitted for brevity
    }

LifecycleController.java

    @Controller
    public class LifecycleController {

        @Autowired
        ServiceJpa serviceJpa;


        @GetMapping(value = "/savePerson")
        public String savePersonAddress () {


            Person person1 = new Person("Jack");

            Address address1 = new Address( "New York" );
            Address address2 = new Address( "Los Angeles" );

            person1.addAddress( address1 );
            person1.addAddress( address2 );

            serviceJpa.savPerson( person1 );


            return "/savePerson";
        }

    }

Optional filters in relational database

I’m trying to create a procedure in MySQL/MariaDB with optional filters for each participating table. Assuming the tables are $A, B, C, ldots$, each table may or may not be filtered, and the result is that of each table having their respective optional filters applied. $A$ and $B$ have the relation A (1) -> (*) B, and similarly, B (1) -> (*) C and so on.

With that, I’ve thought of the following function to filter & join each pair of tables:

/*
  F(): filter
  L: left side
  R: right side
*/

if(L.filter is NULL and R.filter is NULL) {
  return fullJoin(F(L), F(R))
} else if(L.filter not NULL and R.filter is NULL) {
  return leftJoin(F(L), F(R))
} else if(L.filter is NULL and R.filter not NULL) {
  return rightJoin(F(L), F(R))
} else { // both not NULL
  return innerJoin(F(L), F(R))
}

The filter function F() would be something like SELECT * FROM table WHERE input == NULL or input == column. The function is first applied to 4 tables as follows:

fn(fn(fn(A,B),C),D)

where the result of said function fn is considered to have a not NULL filter.

Additionally, I think the function fn can be packed into the following:

SELECT * FROM L FULL JOIN R 
WHERE (R.input == NULL || R.input = R.column)
AND (L.input == NULL || L.input = L.column)

Is my function correct?

javascript – Need to get data from product page to a cart as a slider side panel and have mysql database data show up my fields

products page -> goes to Cart page From(Add to Cart button) When pressed, it sends customer to Cart Page which should be visible as a slider panel which holds the Cart Data for Add to Cart Entry includes quantity, price, picture thumb, and total price with a checkout button going to Paypal Checkout. Working with mysql database (products table) and PHP and javascript / CSS as my landing pages.

testing – How to simulate test data to a database?

The best way to get the data for test in is the same way that it will get in in production, because its the most realistic.

So the question here is how exactly does this third part software get its data in? inserts, a sproc, an API, SSIS? use the same method to insert your test data.

If you don’t know or cant tell, then you could run the tool and check the database log, or monitor the network traffic. perhaps you can even rerun the transactions

Best database design for performing binary analysis

I have some binary data that I would like to do some statistical analysis on. Let’s say I have a few thousand 32 bit values. I want to be able to efficiently do things such as calculate parity bits or look at how often a certain bit is a 1 or 0. My first thought is to put that data into a relational db such as postgres. However I’m not sure what would be the best schema for this type of data. I could:

a] store each bit as a column of type boolean
b] store the 32 bit value as one column of type bit string
c] store the 32 bit value as a hex encoded string

Option a seems like it would allow me to do direct queries such as count how many times bit 23 is 1 easily using direct SQL. However, is this an inefficient way to store the data, since each bit takes one byte of space in the db? What is the best data type to use to most efficiently store and perform these types of calculations on binary data?