Showing posts with label dbms. Show all posts
Showing posts with label dbms. Show all posts

September 19, 2017

commit and rollback - transaction management in dbms

Data Base management system

commit and rollback

Commit and rollback maintain the integrety of the transaction

try to update a table name value using update query

update tblProduct set qtyavailable = 200 where  productid = 1;

This database query is not a part of any transaction, as soon as you execute the query the change is made premenant to the datbase immediatly.

then if you execute the select query

Select * from tblProduct

you can see the change is effected in database

but in case of transaction

begin transaction
update tblProduct set qtyavailable = 300 where  productid = 1;

the following change will be made in database. but if you


try to establish a new connection , and run the above select query ... you can see "Executing query"

that becase you just begin the transaction, but not commited , the other users cannot see the uncommited database


that is because, sql server default isolation level is read commit data

set transaction isolation level read uncommited;









July 10, 2013

to search whether a date is in between two date fields through my sql query

How to search whether a date is in between two date fields through my sql query




see the below table

----------------------------------------------------------
id | start_date    | end_date     | amount | status  | particular
-----------------------------------------------------------
1  | 12-02-2012 |13-07-2013  | 1729    | active  | Zulily
-----------------------------------------------------------
2  | 07-02-2014 |23-02-2014  | 1989   | active  | IOS 7
-----------------------------------------------------------
3  | 07-03-2014 |16-03-2014  | 1987    | active  | Windows 8.1
-----------------------------------------------------------
4  | 12-06-2014 |13-07-2014  | 1987    | active  | Ouya
-----------------------------------------------------------
5  | 12-10-2014 |28-11-2014  |2013    | active  | Comet C/2012
 -----------------------------------------------------------




 SQL query : select * from tbl_interest_rates where now() between start_date and  end_date;
Dated : 10 jully 2013

result  : 1  | 12-02-2012 |13-07-2013  | 1729    | active  | Zulily



This example will find whether the given date is inbetween dates in the given table.

+Shimjith Kumar
+Vipin Cp


http://belazy.blog.com/

Facebook comments