They both worked great, but I went with the non-pivot version. Thanks, man.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
I am doing a Result Analysis project for my college. So basically students will enter the grades that they have obtained for various subjects. If they fail for an exam and take the exam again they need to enter the details of that as well.
For the result, we have to find the list of students who passed for a subject in the first attemt, second attempt upto the nth attempt...What will be an efficient Database design for this problem? What tables should be created and what data should be stored in each?
Please help...struggling with this for the past few weeks
I don't know how to write this PL/SQL in oracle, thanks for your advice.
Because the amount of data in the table is large, it is not suitable to find the max PDate and then compare it from the source table.
Process PDate Status
100 2022/05/21 19:58:030100 2022/05/22 07:01:000100 2022/05/22 13:01:101101 2022/05/22 08:23:390101 2022/05/22 10:17:390101 2022/05/22 17:49:391102 2022/05/22 13:14:480
Requirement: Get the status of the last record of different processes on 2022/05/22
Process PDate Status
100 2022/05/22 13:01:101101 2022/05/22 17:49:391102 2022/05/22 13:14:480
This is something I found some of the younger generation like to promote, put all your logic and processing in the business layer, make the database purely a storage facility. The argument is that you can spawn more processes from the BL to support growth.
IMHO this is utter and absolute bullshit! Databases are optomised to support data PROCESSING as well as storage, that processing is done by stored procedures.
We once did a test, I wrote a SP and a rather brilliant junior wrote a C# process to do the same long running process, the DB was dramatically faster.
Never underestimate the power of human stupidity -
I'm old. I know stuff - JSOP
Where that typically means one or more of the following.
1. They are inexperienced.
2. They have no idea how to solve problems that show up
3. They have no expectation that problems will even show up.
4. They have no intention of being the one tasked with fixing the problems.
I then used those Amended dates in a datediff calculation to get the number of days in each range that fell in April 2022.
This approach is flawed - in that I get 9, 0 and 4 as the results instead of 10, 0, 5. I will leave that as an exercise for you to sort out. I also coded this in MSSQL so you may need to make minor syntactical changes
1) Developing a WebService on a DMZ server which will connect back to corporate SQL2019 server.
2) There are lots of other databases on this server, however there will be only one database (DB_X) which these WebServices need to interact.
3) Assume user, WEBAPI_USER, is created.
Also executed: DENY VIEW ANY DATABASE TO WEBAPI_USER;
4) Now, that user cannot see any databases via MS SQL Server Studio, not even the DB_X database which has been granted access
Note: Kind of crazy because if you run the query: SELECT * FROM SYSOBJECTS WHERE XTYPE = 'U', you will get a full list of all the tables. If done some research on this and it appears that WEBAPI_USER would need to become the owner of the databaase to see it in MSSS.
Question: What is everyone else doing to create a limited access MS-SQL user ?
First create the user.
Second give it access to the specific database.
Until you give it access it should not be able to do anything. Which is why your description seems off. Seems to suggest that you created it with access to everything and now you want to restrict that access. So whatever you did to create it in the first place is wrong.
I want to print **Left_id** first, then only print **Right_id**. May I know how to do it?
I'm not entirely sure what you mean here, but it sounds like you want the columns in a different order in your result. In the example above I used select * - that is not actually good practice. It is much better to list the columns that you want, in the order that you want them - this helps protect any code that is using the results from any subsequent changes to the table schema, such as adding a new column.
However, if you mean you want to sort by one column within the "grouping" of another column then you simply add a list of things to sort by.
var query = teacherCollection.Aggregate().Match(x => x.TeacherFilter== TeacherFilter); //filter teachvar query1 = query
.Lookup<Teacher, Student, TeacherStudent>(studentCollection, t => t.Id, s => s.TeacherId, l => l.Student)
.Unwind(x => x.Student, new AggregateUnwindOptions<TeacherStudent>())
.Match(x => x.StudentFilter== StudentFilter) //filter student
For the teacher collection, useless data has been filter out which will reduce the data size when doing the lookup(join). But for the student collection, the match stage is appended after the lookup. so does all the data from student will join with teacher behind the scenes? is it possible to filter out some student data before the lookup?