Showing posts with label tables. Show all posts
Showing posts with label tables. Show all posts

Monday, March 19, 2012

Maintaining SQL data on a remote host.

Hi,
What is the preferred way to maintain SQL tables on a remote host?
I am a newbie to building ASP.NET websites on a remote host.
A stumbling point has been the maintenance of SQL tables on the remote host.
I understand about doing complete backup and restores,
but I am seeking a quicker way to maintain individual files.
I would like to click and edit but instead am going through the following 30+ clicks.
Is there a easier way?
Thanks.

For example, what I do now to build a new data table for a hosted website.
1) Design table
1a) Name
1b) Fields & Types

2) SQL Server Management Studio Express (assuming existing database)
2a) Select Database & Tables
2b) Add new table
2c) Add fields, Key must be INT for ACCESS
2d) Save as (Name_Table)

3) MS Access (requires ODBC to be setup first through the Windows control panel)
3a) Tables / New / Link / ODBC /Machine_Data_Source
3b) Pick table
3c) Edit data, as needed

4) To transfer data, first:
Select the database in the VWD solution explorer,
then right-click and select the new "Publish to Provider"
4a) Database Publishing Wizard
4b) Choose table to script a backup from
4c) Build script & Copy

5) Start Ipswitch FTP ( this step can be rplaced by 6e below)
5a) locate folder & sql script file and choose destination directory
5b) Transfer file

6) Login to remote host host (1and1)
6a) MS SQL Administration
6b) Admin (MyLittleTools Admin)
6c) Tools
6d) Quey Analyser
6e) Paste script (from step 4)
6f) Submit (Run)
6g) Verify table built

FYI: Script to build and populate the new table "Name_Table"
Built by step 4c above, pasted into remote Hosts Query Analyzer by step 6e above.

/****** Object: Table [dbo].[Name_Table] Script Date: 10/28/2007 18:03:58 ******/
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Name_Table]') AND type in (N'U'))
DROP TABLE [dbo].[Name_Table]
GO
/****** Object: Table [dbo].[Name_Table] Script Date: 10/28/2007 18:03:58 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Name_Table]') AND type in (N'U'))
BEGIN
CREATE TABLE [dbo].[Name_Table](
[ID] [int] NOT NULL,
[Name] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Address] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[City] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[State] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Zip] [nchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Acsz] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Phone] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Fax] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
CONSTRAINT [PK_Name_Table_1] PRIMARY KEY CLUSTERED
(
[ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS =

ON)
)
END
GO
INSERT [dbo].[Name_Table] ([ID], [Name], [Address], [City], [State], [Zip], [Acsz], [Phone], [Fax]) VALUES (1, NULL, NULL,

NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Name_Table] ([ID], [Name], [Address], [City], [State], [Zip], [Acsz], [Phone], [Fax]) VALUES (2, NULL, NULL,

NULL, NULL, NULL, NULL, NULL, NULL)
INSERT [dbo].[Name_Table] ([ID], [Name], [Address], [City], [State], [Zip], [Acsz], [Phone], [Fax]) VALUES (3, N'Third

name', NULL, NULL, NULL, NULL, NULL, NULL, NULL)


You should take a good look at SSIS (Sql Server Integration Services).

It's quite nice and made for moving data from one database to another.

Another option is to create a database link from one server to another and use t-sql to move the data. Would recommend using SSIS if possible.


Maintaining a one-to-one match on related tables

I have a series of tables already containing data. The first table is a list
of employees. The next is a list of team names.
There is a Primary Key for each employee which relates to a foreign key in
the team names.
The employee table would have
pkid
FirstName
LastName
fkOfficeID
department
The team table would have only
fkEmployeeID
TeamName
Now, I know how to generate a SELECT set with a LEFT JOIN and a search for
NULL in the TeamName to generate a list of employees that do not have a team
name assigned to them, however. Not every employee would have a coresponding
record in the team table, only certain offices have teams.
What is the statement that would:
"INSERT and UPDATE a specific team name record in the team table for
each corresponding record in the employee table for any employee who's
"Office ID" is 5 department is Accounting and is missing a record in the
team table."
I could VB my way through this by
Creating the list of all offices that have teams
Creating the SELECT set mentioned above and whittling it down to
those employees in each office who are in Accounting
IF NOT EXISTS-ing my way through the team list and adding the
appopriate team record
But, is there an easier way? Is it a two step process, one to determine the
missing records in the one-to-one relationship where needed and then do the
team table update?
Julianand the vb programmers here wonder why vb makes me pull my hair out... ;)
insert into team (fkEmployeeID, TeamName)
select e.pkid, 'Office 5 Accounting Team 1'
from employee e
where fkofficeid=5
and department='Accounting'
and not exists (select * from team where fkemployeeid=e.pkid)
not sure what you need to update...
stjulian wrote:
> I have a series of tables already containing data. The first table is a li
st
> of employees. The next is a list of team names.
> There is a Primary Key for each employee which relates to a foreign key in
> the team names.
> The employee table would have
> pkid
> FirstName
> LastName
> fkOfficeID
> department
> The team table would have only
> fkEmployeeID
> TeamName
>
> Now, I know how to generate a SELECT set with a LEFT JOIN and a search for
> NULL in the TeamName to generate a list of employees that do not have a te
am
> name assigned to them, however. Not every employee would have a corespondi
ng
> record in the team table, only certain offices have teams.
> What is the statement that would:
> "INSERT and UPDATE a specific team name record in the team table for
> each corresponding record in the employee table for any employee who's
> "Office ID" is 5 department is Accounting and is missing a record in the
> team table."
> I could VB my way through this by
> Creating the list of all offices that have teams
> Creating the SELECT set mentioned above and whittling it down to
> those employees in each office who are in Accounting
> IF NOT EXISTS-ing my way through the team list and adding the
> appopriate team record
> But, is there an easier way? Is it a two step process, one to determine th
e
> missing records in the one-to-one relationship where needed and then do th
e
> team table update?
> Julian
>
>|||I think like a VB programmer, you know, linearly. What I love about you guys
in SQL is your way of looking at data in 3 dimensions. Folding it on itself
(using table aliases).
Should the line be "from employee AS e" ?
I should take a class on query design.
I'll give it a try tomorrow. Keep an eye on this thread.
Julian
"Trey Walpole" <treypole@.newsgroups.nospam> wrote in message
news:eETCybEAGHA.1268@.TK2MSFTNGP11.phx.gbl...
> and the vb programmers here wonder why vb makes me pull my hair out... ;)
> insert into team (fkEmployeeID, TeamName)
> select e.pkid, 'Office 5 Accounting Team 1'
> from employee e
> where fkofficeid=5
> and department='Accounting'
> and not exists (select * from team where fkemployeeid=e.pkid)
>
> not sure what you need to update...
> stjulian wrote:|||Although the issues are 2D, thinking 3D is more impressive. :)
ML
http://milambda.blogspot.com/|||I prefer thinking of it as
VB = "For each x, do this"
SQL = "For all x's, do this"
the AS is optional in aliasing a table or column.
my personal preference is to include AS for column aliases and not for
table aliases.
stjulian wrote:
> I think like a VB programmer, you know, linearly. What I love about you gu
ys
> in SQL is your way of looking at data in 3 dimensions. Folding it on itsel
f
> (using table aliases).
> Should the line be "from employee AS e" ?
> I should take a class on query design.
> I'll give it a try tomorrow. Keep an eye on this thread.
> Julian
>
> "Trey Walpole" <treypole@.newsgroups.nospam> wrote in message
> news:eETCybEAGHA.1268@.TK2MSFTNGP11.phx.gbl...
>

Friday, March 9, 2012

Main and detail table amount calculations

Hi all,

I have a 2 main tables in my system. One is main table has ticket information location and so on. And detail table which hold all actions on that record with multiple money fields (its around 5 fields). it goes trough some crazy calculations on the detail table and get 5 results for each ticket. And this calculation is done everytime the ticket is looked at.
There is around 10 detail records per 1 main record. and the main table is around 7 mil. records

Now i got 2 options. I can create a trigger that does the calculation and update the main table show the results from there. This is going to affect all updates deletes and inserts.

OR

I can leave as it is so only when they view the ticket it does the calculation. Dont ask me how often they view it i dont have a clue.( if there is any suggestion how to get the count i could try to do it. )
:confused:
Suggestions

(My attitude is going towards the trigger way but 100 percent sure)I can leave as it is so only when they view the ticket it does the calculation.
Yes, you really only want to calculate results from values that are stored in a database and return those results to the client app/report/whatever. Storing calculated values is usually a bad idea. If I were you, I'd go with a third table that details each money field. So, you have the main table, the table with ticket details, then have another table with money details for the ticket details.

eg. Fields:
TicketID, DetailID, MoneyTypeID, Value
-----------
1,1,1,10.00
1,2,1,30.00
1,2,2,1.00
1,2,3,10.50|||you got the question wrong i really dont have too much of changing the data structure is not an big option since the system is already built. I dont have that much options of adding another detailed money table. I need is to decide if i should use triggers and the main table for the calculations or do the calculations on every view Thanks.|||Dont ask me how often they view it i dont have a clue.( if there is any suggestion how to get the count i could try to do it. )
:confused:
How often do they view it? Oh right right - I wasn't to ask :)

If they are accessing this via a sproc then the easy method is log every execution (in fact do this for every sproc) to a table and then query your table.

If not then you could run a profiler trace (http://www.developer.com/db/article.php/3482216) save the results to a table or to a trace file (trace file is more efficient and you can dump the results in a table once the trace is over) and query the table. You would be querying the TextData column for the SQL:BatchCompleted event.

HTH|||sadly on the server there is a wierd problem. Trace is not working. and lets say for how often they look up a ticket is, insanely often. probably the data is viewed alot more often then it is updated. I hope that make sense to help awnser the main part of the question. Thanks

Saturday, February 25, 2012

Magic Tables with Text Columns

Hi folks,

I need to execute some kind of

select a,b,c into #inserted from inserted

a = int
b = varchar(50)
c = text

Easy so far. But I what I need is to find out whether the audited table contains text(or nText / image) columns or not. If it contains any text columns the statement should automatically be changed to

select a,b into #inserted from inserted

Remember that the trigger must be usable for any table in the database without manually entering the tables structure or the column names.

Best would be fetching the structure fropm the system views (INFORMATIONSCHEMES)

Any suggestions ?

Thanks a lot!

StefanTRIGGERS are built for a table, and as such are a "property" of that table.

The only way would be to build dynamic sql with each trigger for each table.

Meaning you would still have to build a trigger per table anyway.

So why not just build them the way they need to be per table?

And what's with the temp table?

Machine to run SQL 2000

Our current SQL server box is a Dell PowerEdge 4400 with one PIII Xeon
800Mhz CPU and 768MB RAM. Some of the tables we have are quite large (~50
million rows) and as of late we have noticed a degradation in performance.
As we will be needing a new server to host our new website, we have decided
to relegate the 4400 to web hosting and buy a new SQL server box. I know
there is time to be spent running profiler / perfmon etc to track down the
source of the performance problems, but we WILL be needing a new box first,
then I can start to diagnose the perf. issues.
What I would like to know is what factors are MOST important when
considering a machine to run SQL server i.e. CPU Mhz, Dual/Quad processor,
RAM, On-chip cache etc. I know the best advise is usually "get the best
machine you can afford" but when weighing up the options there are some
things that have to be decided on an either/or basis i.e. a one-CPU machine
with 1MB cache, or a dual-CPU machine with 512KB cache.
Many thanks for any input,
dfAll of this is my experience and personal opinion. YMMV.
I prefer more CPUs to bigger CPU cache.
More memory is preferable to faster CPUs, within reason. Unless you are
running Enterprise Edition, anything over 4GB in the box is wasted so plan
accordingly. If you are using Enterprise edition, put as much memory as you
can afford in the box.
RAID-10 is three to five times faster than RAID-5. Lots of drive spindles
is a cheap way to boost performance.
Definitely use Windows Server 2003 as the OS.
Since you are a Dell shop, you might want to check out the CX-200
entry-level SAN. It is a bit more than a SCSI Powervault, but not
prohibitively so. I would seriously look into the best PowerEdge 6650 I
could afford with a CX-200 back-end. If not, maybe a 6600 with 12 internal
SCSI drives. Obviously , we all have budget constraints but definitely
squeeze every bit you can for this.
--
Geoff N. Hiten
SQL Server MVP
Senior Database Administrator
Careerbuilder.com
"digitalfish" <digital.fish@.ntlworld.com> wrote in message
news:gxyeb.2143976$Bf5.300990@.news.easynews.com...
> Our current SQL server box is a Dell PowerEdge 4400 with one PIII Xeon
> 800Mhz CPU and 768MB RAM. Some of the tables we have are quite large (~50
> million rows) and as of late we have noticed a degradation in performance.
> As we will be needing a new server to host our new website, we have
decided
> to relegate the 4400 to web hosting and buy a new SQL server box. I know
> there is time to be spent running profiler / perfmon etc to track down the
> source of the performance problems, but we WILL be needing a new box
first,
> then I can start to diagnose the perf. issues.
> What I would like to know is what factors are MOST important when
> considering a machine to run SQL server i.e. CPU Mhz, Dual/Quad processor,
> RAM, On-chip cache etc. I know the best advise is usually "get the best
> machine you can afford" but when weighing up the options there are some
> things that have to be decided on an either/or basis i.e. a one-CPU
machine
> with 1MB cache, or a dual-CPU machine with 512KB cache.
> Many thanks for any input,
> df
>|||On Wed, 01 Oct 2003 11:04:44 GMT, "digitalfish"
<digital.fish@.ntlworld.com> wrote:
>Many thanks for any input,
Preference to the dual cpu -- the benefits outweigh the problems.
Lots o' RAM.
RAID disk. Used to be a big deal to mirror the log and stripe the
main store, I don't quite know now what's optimal. IMO, big RAM makes
a lot of that less important. Depends how big the database is and the
kind of traffic you do on it, of course.
J.|||Geoff;
I agree with you on the general choice between more CPUs and bigger CPU
cache, and between more memory and faster CPUs.
What would be your choice between faster CPUs and more CPU cache? In total
abstract and in general, my perference has been more CPU cache. Obviously,
I'm not talking about going from 400MHz to 2.6GHz.
--
Linchi Shea
linchi_shea@.NOSPAMml.com
"Geoff N. Hiten" <SRDBA@.Careerbuilder.com> wrote in message
news:uioFyHCiDHA.4024@.TK2MSFTNGP11.phx.gbl...
> All of this is my experience and personal opinion. YMMV.
> I prefer more CPUs to bigger CPU cache.
> More memory is preferable to faster CPUs, within reason. Unless you are
> running Enterprise Edition, anything over 4GB in the box is wasted so plan
> accordingly. If you are using Enterprise edition, put as much memory as
you
> can afford in the box.
> RAID-10 is three to five times faster than RAID-5. Lots of drive spindles
> is a cheap way to boost performance.
> Definitely use Windows Server 2003 as the OS.
> Since you are a Dell shop, you might want to check out the CX-200
> entry-level SAN. It is a bit more than a SCSI Powervault, but not
> prohibitively so. I would seriously look into the best PowerEdge 6650 I
> could afford with a CX-200 back-end. If not, maybe a 6600 with 12
internal
> SCSI drives. Obviously , we all have budget constraints but definitely
> squeeze every bit you can for this.
> --
> Geoff N. Hiten
> SQL Server MVP
> Senior Database Administrator
> Careerbuilder.com
>
>
> "digitalfish" <digital.fish@.ntlworld.com> wrote in message
> news:gxyeb.2143976$Bf5.300990@.news.easynews.com...
> > Our current SQL server box is a Dell PowerEdge 4400 with one PIII Xeon
> > 800Mhz CPU and 768MB RAM. Some of the tables we have are quite large
(~50
> > million rows) and as of late we have noticed a degradation in
performance.
> > As we will be needing a new server to host our new website, we have
> decided
> > to relegate the 4400 to web hosting and buy a new SQL server box. I know
> > there is time to be spent running profiler / perfmon etc to track down
the
> > source of the performance problems, but we WILL be needing a new box
> first,
> > then I can start to diagnose the perf. issues.
> >
> > What I would like to know is what factors are MOST important when
> > considering a machine to run SQL server i.e. CPU Mhz, Dual/Quad
processor,
> > RAM, On-chip cache etc. I know the best advise is usually "get the best
> > machine you can afford" but when weighing up the options there are some
> > things that have to be decided on an either/or basis i.e. a one-CPU
> machine
> > with 1MB cache, or a dual-CPU machine with 512KB cache.
> >
> > Many thanks for any input,
> > df
> >
> >
>|||Tough call. Most 4+ way systems now have 1MB cache except on the very
fastest processors which have 2MB cache, so you really don't get a tradeoff
there. It is either faster AND more cache or not. As an example, a Dell
PowerEdge 6600/6650 can currently have either 2.5GHz processors with 1MB
cache or 2.8GHz processors with 2MB cache. If you have to compromise, back
off the processor speed/cache slightly and get more RAM and a better disk
subsystem.
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
"Linchi Shea" <linchi_shea@.NOSPAMml.com> wrote in message
news:%23wDjVyJiDHA.2120@.TK2MSFTNGP10.phx.gbl...
> Geoff;
> I agree with you on the general choice between more CPUs and bigger CPU
> cache, and between more memory and faster CPUs.
> What would be your choice between faster CPUs and more CPU cache? In total
> abstract and in general, my perference has been more CPU cache. Obviously,
> I'm not talking about going from 400MHz to 2.6GHz.
> --
> Linchi Shea
> linchi_shea@.NOSPAMml.com
>
> "Geoff N. Hiten" <SRDBA@.Careerbuilder.com> wrote in message
> news:uioFyHCiDHA.4024@.TK2MSFTNGP11.phx.gbl...
> > All of this is my experience and personal opinion. YMMV.
> >
> > I prefer more CPUs to bigger CPU cache.
> > More memory is preferable to faster CPUs, within reason. Unless you are
> > running Enterprise Edition, anything over 4GB in the box is wasted so
plan
> > accordingly. If you are using Enterprise edition, put as much memory as
> you
> > can afford in the box.
> > RAID-10 is three to five times faster than RAID-5. Lots of drive
spindles
> > is a cheap way to boost performance.
> > Definitely use Windows Server 2003 as the OS.
> >
> > Since you are a Dell shop, you might want to check out the CX-200
> > entry-level SAN. It is a bit more than a SCSI Powervault, but not
> > prohibitively so. I would seriously look into the best PowerEdge 6650 I
> > could afford with a CX-200 back-end. If not, maybe a 6600 with 12
> internal
> > SCSI drives. Obviously , we all have budget constraints but definitely
> > squeeze every bit you can for this.
> >
> > --
> > Geoff N. Hiten
> > SQL Server MVP
> > Senior Database Administrator
> > Careerbuilder.com
> >
> >
> >
> >
> >
> > "digitalfish" <digital.fish@.ntlworld.com> wrote in message
> > news:gxyeb.2143976$Bf5.300990@.news.easynews.com...
> > > Our current SQL server box is a Dell PowerEdge 4400 with one PIII Xeon
> > > 800Mhz CPU and 768MB RAM. Some of the tables we have are quite large
> (~50
> > > million rows) and as of late we have noticed a degradation in
> performance.
> > > As we will be needing a new server to host our new website, we have
> > decided
> > > to relegate the 4400 to web hosting and buy a new SQL server box. I
know
> > > there is time to be spent running profiler / perfmon etc to track down
> the
> > > source of the performance problems, but we WILL be needing a new box
> > first,
> > > then I can start to diagnose the perf. issues.
> > >
> > > What I would like to know is what factors are MOST important when
> > > considering a machine to run SQL server i.e. CPU Mhz, Dual/Quad
> processor,
> > > RAM, On-chip cache etc. I know the best advise is usually "get the
best
> > > machine you can afford" but when weighing up the options there are
some
> > > things that have to be decided on an either/or basis i.e. a one-CPU
> > machine
> > > with 1MB cache, or a dual-CPU machine with 512KB cache.
> > >
> > > Many thanks for any input,
> > > df
> > >
> > >
> >
> >
>|||Minimum 2 CPU's, 2 GB RAM.
Preferred:
4 CPU's, 4-8 GB RAM. RAID array.
CPU speed or cache does not matter nearly as much at having 2 or more and
having lots of RAM, and a RAID array. RAID 5 or 10.
In order of preference - price vs performance
2 CPU
2 GB RAM
RAID 5
4 GB RAM
4 CPU's
RAID 10
J
www.urbanvoyeur.com
"digitalfish" <digital.fish@.ntlworld.com> wrote in message
news:gxyeb.2143976$Bf5.300990@.news.easynews.com...
> Our current SQL server box is a Dell PowerEdge 4400 with one PIII Xeon
> 800Mhz CPU and 768MB RAM. Some of the tables we have are quite large (~50
> million rows) and as of late we have noticed a degradation in performance.
> As we will be needing a new server to host our new website, we have
decided
> to relegate the 4400 to web hosting and buy a new SQL server box. I know
> there is time to be spent running profiler / perfmon etc to track down the
> source of the performance problems, but we WILL be needing a new box
first,
> then I can start to diagnose the perf. issues.
> What I would like to know is what factors are MOST important when
> considering a machine to run SQL server i.e. CPU Mhz, Dual/Quad processor,
> RAM, On-chip cache etc. I know the best advise is usually "get the best
> machine you can afford" but when weighing up the options there are some
> things that have to be decided on an either/or basis i.e. a one-CPU
machine
> with 1MB cache, or a dual-CPU machine with 512KB cache.
> Many thanks for any input,
> df
>

Monday, February 20, 2012

Lowest Marks

I have the following 3 tables.
Student Table : S_ID, FNAME, LNAME
UNIT : U_ID, UNITNAME
Marks Table : S_ID, U_ID, YEAR, MARKS
A student can enrol in multiple units of study each year. At enrolment by default their marks is zero.

Given a certain year we need to output the lowest marks obtained by a student in each unit. Students with zero marks should be excluded.
The SQL query shall output the following :
FNAME, LNAME, UNITNAME, MARKS
Example find the lowest marks obtained for all units in 2002. (The unitname can only appear once in the result).

Can the above query be performed in a single select statement? If yes how ? If no what is the alternate?Hi
Kindly use the following query to get the required results.

select t1.sid, t1.fname, t1.u_id, l2.u_name, t1.marks from (select l1.sid, l1.fname, l3.u_id, l3.marks from L1, L3 where L1.sid=l3.sid and l3.marks!=0) t1, l2 where t1.u_id=l2.u_id;

Thanx and Regards
Aruneesh|||Everything that you wanted is coming packaged in just one query.
Hope it works for you fine.|||I suppose the question was not clear therefore the reply by aruneeshsalhotr did not answer the qestion. I will try & simplify with an example.

Student Table : S_ID, FNAME, LNAME
Student Data :
001, Jack, Russel
002, Mark, Benny
003, John, Wayne

Unit Table : U_ID, UNITNAME
Unit Data :
MA, Maths
EN, English
SC, Science

Marks Table : S_ID, U_ID, YEAR, MARKS
Marks Data :
001, MA, 2002, 80
001, EN, 2002, 60
001, SC, 2002, 0
002, MA, 2002, 50
002, EN, 2002, 70
002, SC, 2002, 60
003, MA, 2002, 0
003, EN, 2002, 0
003, SC, 2002, 55
003, MA, 2003, 50
003, EN, 2003, 70
001, SC, 2003, 50

The Output required for the query -> find the lowest marks obtained for all units in 2002 is as follows:
FNAME, LNAME, UNITNAME, MARKS
Jack, Russel, English, 60
Mark, Benny, Maths, 50
John, Wayne, Science, 55
In the above result all those with 0 marks have been eliminated.

Is it possible to have a all in one query for the above output?