السبت، 13 يونيو 2015

Lession (1) Database Designing & Modeling

بسم الله الرحمن الرحيم


تحليل وتصميم وبناء أنظمة قواعد البيانات باستخدام


2012 SQL Server

Database Designing & Modeling section (Part 1)

رابط الدرس:




Syllabus:

Data Model Defintion
Information Levels
Data Models at Information Levels
Data Model Components
Data Model Quality
Data Model Characteristics
Data System Development
Data System Development Life Cycle
Roles and Responsibilities
Data Modeling Approaches
OLTP
Data Warehouse
Postrelational Databases
Edraw Max

الخميس، 11 يونيو 2015

On delete cascade & On update cascade SQL Server Tips

Simple example to illustrate to amazing features in SQL server "On delete cascade & On update cascade"

Building Sample Data

USE [TestDB]
GO
-- Creating Table Products
CREATE TABLE [dbo].[Products](
[ProductID] [int] NOT NULL,
[ProductDesc] [varchar](50) NOT NULL,
CONSTRAINT [PK_Products] PRIMARY KEY CLUSTERED
(
[ProductID] ASC
)) ON [PRIMARY]
GO
-- Creating Table ProductDetails
CREATE TABLE [dbo].[ProductDetails](
[ProductDetailID] [int] NOT NULL,
[ProductID] [int] NOT NULL,
[Total] [int] NOT NULL,
CONSTRAINT [PK_ProductDetails] PRIMARY KEY CLUSTERED
(
[ProductDetailID] ASC
)) ON [PRIMARY]
GO
ALTER TABLE [dbo].[ProductDetails] WITH CHECK ADD CONSTRAINT [FK_ProductDetails_Products] FOREIGN KEY([ProductID])
REFERENCES [dbo].[Products] ([ProductID])
ON UPDATE CASCADE
ON DELETE CASCADE
GO
-- Insert Data into Table
USE TestDB
GO
INSERT INTO Products (ProductID, ProductDesc)
SELECT 1, 'Bike'
UNION ALL
SELECT 2, 'Car'
UNION ALL
SELECT 3, 'Books'
GO
INSERT INTO ProductDetails
([ProductDetailID],[ProductID],[Total])
SELECT 1, 1, 200
UNION ALL
SELECT 2, 1, 100
UNION ALL
SELECT 3, 1, 111
UNION ALL
SELECT 4, 2, 200
UNION ALL
SELECT 5, 3, 100
UNION ALL
SELECT 6, 3, 100
UNION ALL
SELECT 7, 3, 200
GO

Select Data from Tables

-- Selecting Data
SELECT *
FROM Products
SELECT *
FROM ProductDetails
GO

cascadedelete1 SQL SERVER   Curious Case of Disappearing Rows   ON UPDATE CASCADE and ON DELETE CASCADE   T SQL Example   Part 2 of 2

Delete Data from Products Table

-- Deleting Data
DELETE
FROM
Products
WHERE ProductID = 1
GO

Select Data from Tables Again

-- Selecting Data
SELECT *
FROM Products
SELECT *
FROM ProductDetails
GO

cascadedelete2 SQL SERVER   Curious Case of Disappearing Rows   ON UPDATE CASCADE and ON DELETE CASCADE   T SQL Example   Part 2 of 2

Clean up Data

-- Clean up
DROP TABLE ProductDetails
DROP TABLE Products
GO

الثلاثاء، 2 يونيو 2015

الدرس (11) - تحليل وتصميم وبناء أنظمة قواعد البيانات باستخدام SQL Server

بسم الله الرحمن الرحيم


تحليل وتصميم وبناء أنظمة قواعد البيانات باستخدام


2012 SQL Server



رابط الدرس:



Syllabus:

Stored Procedure and Functions
Basic Concepts of Stored Procedure
Stored procedure definition
Stored procedure benefits
Stored procedure types 
User-defined stored procedures 
System stored procedures
Using the CREATE PROCEDURE statement 
Using the ALTER PROCEDURE statement 
Using the DROP PROCEDURE statement 
Working with Functions 
Basic Concepts of Functions 
Function definition 
Function benefits 
Function types 
Creating and Calling Functions 
Function Calling
Creating a Scalar-Valued function 
Creating a Table-Valued function 
Creating a Multi-statement Table-Valued function
Modifying and Removing Functions
Triggers
Working with Triggers
Trigger definition and types 
DDL triggers 
DML triggers
DML trigger benefits 
Managing INSTEAD OF triggers 
Creating INSTEAD OF triggers 
Modifying and removing triggers

الاثنين، 1 يونيو 2015

Google Search Operators

Google search operators look interesting:

Auto Generate Android images automatically. using TWO simple steps.

Hi All,
Today we will learn how to auto generate different image resolutions and use it in android studio.

we need TWO steps to crater all these resolution automatically: 
xxxhdpi  xxhdpi  xhdpi  hdpi  mdpi 

Watch my video for details.






the website for Android Asset Studio is:

Converting number to three digit representation eg (1 = 001) in JAVA

Hello everyone
Here is a simple code to converting number to three digit representation by adding prefix to number e.g (1 = 001)  using in java programing language:

First Method:

public int returnThreeDigitNo(int number)
{
    int threeDigitNo = 0;
    int length = String.valueOf(number).length();
    if(length == 1)
    {
        threeDigitNo = 00+number;
    }
    if(length == 2)
    {
        threeDigitNo = 0+number;
    }
    if(length == 3)
    {
        threeDigitNo = number;
    }
    return threeDigitNo;
}


Second Method:

String.format("%03d", yournumber);

Thank you....

Happy programming :)