Author: selman ALPDÜNDAR
MSSQL Server stored procedure
CREATE PROCEDURE ProductInsert( @ProductName varchar(25), @Price int, @ProductInStock int) AS IF EXISTS(SELECT * FROM PRODUCTS WHERE ProductName=@ProductName) BEGIN PRINT 'This product already there is '; END ELSE BEGIN INSERT INTO PRODUCTS (ProductName,Price,ProductInStock) VALUES (@ProductName,@Price,@ProductInStock) END
MSSQL Server Trigger
Trigger is used to run sql query after some action in database like delete, instert, update. I created two tables which are SALES and PRODUCTS.
Continue with reading
MSSQL Server Constraints
There are six constraints which are NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY, CHECK, DEFAULT. I will explain all of them with giving example for each one.
NOT NULL : If you use this constraint for a column then this column cannot contain null value.
UNIQUE : Ensures that every column has a unique value.
PRIMARY KEY : Primary key has two specific rules If a column has primary key constraint then it must be not null and unique. When we use primary key it will help us to find record which we are searching correctly.
FOREIGN KEY : This constraint ensures the value in a column in a table to match value in a column in another table.
CHECK :Ensures which the value in a column meets a specific condition.
DEFAULT : It is using for put a default value when create new record for a column.
Calculating man-month
There is a table which contain three project type we need to know what kind of project we will create.The value of the table can changes for different company
a | b | c | d | |
Organic | 2.4 | 1.05 | 2.5 | 0.38 |
Semi-Detached | 3.0 | 1.12 | 2.5 | 0.35 |
Embedded | 3.6 | 1.20 | 2.5 | 0.32 |
Calculating Person Quality
There is a three steep
- Find the Weighted-Defect from the table this value of table can changes for different company
Defect Types | Weights |
Serious | 10 |
Medium | 3 |
Trivial | 1 |
Decision table for determining the days in a month
M1 = {x: x is a 30-day month}
M2 = {x: x is a 31-day month}
M3 = {x: x is February}
ATM Withdraw Cash – Use Case
Use Case Description: Allows any bank customer to obtain cash from their bank account. This use case begins when an ATM customer chooses a type of account from which the cash is to be withdrawn (e.g. checking) from a list of possible accounts, and to choose a dollar amount from a list of possible amounts. The system sends the transaction to the financial system for verification. If the financial system approves the transaction, the machine dispenses the appropriate amount of cash and issues a receipt. The dispensing of cash is also recorded in the ATM’s log.
Cardinality of real numbers and set of real numbers between 0 and 1
Question : Show that the set of all real numbers has the same cardinality as the set of real number between 0 and 1.
Solution : Solution Let S be the open interval of real numbers between 0 and 1
S={x ∈ R| 0 < x < 1 }.
Imagine picking up S and bending it into circle as shown below. Since S does not include either endpoint 0 or 1, the top-most point of the circle is omitted from the drawing.
Comparison of Dijkstra’s algorithm and Floyd–Warshall algorithm
Floyd-Warshall Algorithm
Stephen Warshall and Robert Floyd independently discovered Floyd’s algorithm in 1962.
The algorithm solves a type of problem call the all-pairs shortest-path problem. Actually, the Warshall version of the algorithm finds the transitive closure of a graph but it does not use weights when finding a path. The Floyd algorithm is essentially the same as the Warshall algorithm except it adds weight to the distance calculation.