<Filter Array into Categorized format/>
Posted by Gaurav Jassal | on 11/15 at 05:59 PM | PHP •
This simple yet powerful class to filters an array and breaks in to a categorized array format.You can use this class if you are dealing with large and complex array and want to convert it into and simple array that is easy to understand and use. Recently i required a function that can categorize an array and break it into categorize format.I couldn't find any core function to do that so i decided to create my own class that can do this job for me. I have also added an example to demonstrate the usage to its benefit. Make sure you comment it if you find it useful.
Original Array
$arrProducts=array(
array(
"product_id" => "007",
"product_name" => "Blackberry R-900 Mobile",
"product_price" => "£450",
"product_status" =>"1",
"product_category" =>"Mobile"
),
array(
"product_id" => "033",
"product_name" => "8 GB Pendrive",
"product_price" => "£14.99",
"product_status" => "0",
"product_category" => "Computers"
)
);
<read complete article/>
<Why use Constraints in SQL ?/>
Posted by Gaurav Jassal | on 10/01 at 02:19 PM | MySQL • PostgresSQL •
Constraints enables business rules to be enforced by the database instead of via application code. Through the judicious use of constraints, application and SQL coding can be minimized and data integrity can be maximized. Constraints may be applied to columns in the form of uniqueness requirements, relational integrity constraints to other tables/rows, allowable values and data types.For example, a column containing a product price should probably only accept positive values. But there is no standard data type that accepts only positive numbers. Another issue is that you might want to constrain column data with respect to other columns or rows. For example, in a table containing product information, there should be only one row for each product number.
With constraints you can have much control over the data and you can have it the way you want to be. You can have same rules in your web applications that you are writing in whatever language like PHP, ASP.NET, Perl, Python but constraints can save your alot of valuable time.
Constraints, in SQL Server, can be used to:
- # Enforce the range of data values that can be stored in a column (check constraints)
- # Enforce the uniqueness of a column or group of columns within a table (unique / primary key constraints)
- # Eenforce referential integrity (primary key and foreign key constraints)
A PRIMARY KEY constraint is a unique identifier for a row within a database table. Every table should have a primary key constraint to uniquely identify each row and only one primary key constraint can be created for each table. The primary key constraints are used to enforce entity integrity.
CREATE TABLE products (
product_no integer PRIMARY KEY,
name text,
price numeric
);
<read complete article/>
<Google’s Project10tothe100/>
Posted by Gaurav Jassal | on 09/29 at 10:09 AM | Daily Digest • News •
Google came up with a new project called Project10tothe100 Google has sent an invitation to all the people who has an idea or ideas to change the world, just share the same with Google and help the people in all.
<read complete article/>










