Professional Documents
Culture Documents
PRACTICAL
FILE
Practical 6 JOINS
Practical 7 SQL sub-queries
VISUAL BASIC
Practical 8 Simple Calculator
Practical 9 EOQ Model
The following commands could also be used to get an overview of the table:
sp_help 'categories';
sp_help 'customers';
sp_help 'employees';
sp_help 'order_details';
sp_help 'orders';
sp_help 'products';
sp_help 'shippers';
sp_help 'suppliers';
PRACTICAL 2
DML Commands (INSERT & SELECT)
-- Account which are not of Assests types
SELECT TOP 15 percent *
FROM DimAccount
WHERE AccountType <> 'Assets';
-- Upper-Income category
SELECT Concat(FirstName,' ', MiddleName,' ', LastName) as Name,
Gender, MaritalStatus
FROM DimCustomer
WHERE YearlyIncome >= 100000;
-- All the currencies present in the dataset DimCurrency
SELECT *
FROM DimCurrency;
AFTER:
-- In the employee data, there are 2 Barbara's and considering the
case one of them wants to modify their name
SELECT *
FROM DimEmployee
WHERE FirstName = 'Barbara';
UPDATE DimEmployee
SET FirstName = 'Barbra'
WHERE EmployeeKey = 182;
-- No of Male/Female Employees
SELECT COUNT(CASE WHEN DimEmployee.Gender='M' THEN 1 END) As
Male,COUNT(CASE WHEN Gender='F' THEN 1 END) As Female,COUNT(CASE WHEN
(Gender='' OR Gender IS Null) THEN 1 END) As 'NotAssigned', COUNT(*)
as Total
FROM DimEmployee;
FORM LAYOUT:
OUTPUT:
PRACTICAL 10
SIMPLE INTEREST CALCULATOR
Private Sub Command1_Click()
Dim principle As Double
Dim rate As Double
Dim time As Integer
principle = Val(txtprinciple.Text)
rate = Val(txtrate.Text)
time = Val(txttime.Text)
txtSI = (principle * rate * time) / 100
End Sub
Private Sub Command2_Click()
txtprinciple.Text = ""
txtrate.Text = ""
txttime.Text = ""
txtSI.Text = ""
End Sub
FORM LAYOUT:
OUTPUT
PRACTICAL 11
PERCENTAGE & CGPA CALCULATOR
Private Sub Command1_Click() Private Sub Command2_Click()
Dim db As Double txtdb.Text = ""
Dim ec As Double txtec.Text = ""
Dim sch As Double txtsch.Text = ""
Dim mkt As Double txtmkt.Text = ""
Dim cv As Double txtcv.Text = ""
Dim total As Double txtpercent.Text = ""
Dim percent As Double txtcgpa.Text = ""
Dim cgpa As Double End Sub
db = Val(txtdb.Text)
ec = Val(txtec.Text)
sch = Val(txtsch.Text)
mkt = Val(txtmkt.Text)
cv = Val(txtcv.Text)
total = db + ec + sch + mkt + cv
percent = (total / 500) * 100
txtpercent.Text = percent
cgpa = percent / 9.5
If cgpa >= 10 Then
cgpa = 10
End If
txtcgpa.Text = cgpa
End Sub
OUTPUT:
PRACTICAL 12
Largest number out of 10 entered
numbers using Arrays
Private Sub SortArray(x() As Double)
Dim n As Double
Dim Temp As Double
Dim bln As Boolean
bln = True
Do While bln
bln = False
For n = LBound(x) To (UBound(x) - 1)
If x(n) > x(n + 1) Then
Temp = x(n)
x(n) = x(n + 1)
x(n + 1) = Temp
bln = True
End If
Next
Loop
End Sub
For i = 0 To 9 Step 1
begin:
n = Val(InputBox("Enter the number " & i + 1 & " : "))
num(i) = n
Next i
SortArray num
MsgBox ("Largest Number is " & num(9))
End Sub
…. And soo on to enter all the 10 number.
All the 10 numbers are: 65, 166, 21, 567, 777, 912, 55, 87, 12, 8
Final Output: