Skip to main content

Posts

difference between view and materialized view

difference  between view & materialized view  View never come until you call them, but once you created materialized view you needn't call that view if the records are equivalent to the records of your select statements/original table.optimiser never contacts to the basetable, if you have created a materialized view equivalent to basetable.In the view you can write "Create or Replace" but in materialized view u can't.If you want to change materialized view, you have to drop that materialized view and create that again. view is a logical or virtual table it doesn't have data on its own, but materialized view has a physical structure it stores data in local machine or on its own.materialized view can be refreshed automatically or manually. but in view, if any changes happened in the base tables, we want to reflect the same in the view means view has to issue the select statement again to the database.

Example of PL/Sql for monthly sales

declare start_date date; end_date date; begin select min(sales_date),max(sales_date) into start_date, end_date from t1; for start_date <= end_date loop Insert Into t1 (ShopName , sales_Date, Sales) Select t2.ShopName , nvl(t1.sales_Date,start_date), nvl(t1.Sales,0) From t1, t2 Where t1.sales_Date=start_date; start_date:=start_date+1; end loop; end;

Difference Normal INDEX And BITMAP INDEX

Difference Normal INDEX And BITMAP INDEX Normal index is cannot give indexes for Duplicate values in column values But BITMAP INDEX is gives Indexes for duplicate values also depend on Their ROWID. So BITMAP INDEX created on columns containing less distinct values means duplicates contain column for better performance BITMAP INDEX. WE can use B-Tree index where data cardinality is high and many DML operations are performed and have many distinct values. while Bitmap will use when have low cardinality and less distinct value like gender column(M/F) or value does not update frequently

Difference between alias and synonym in sql

Difference between  alias and synonym in sql Both are different in all manner not only syntactically Synonym is 1. It is a database object 2. It may be Public or private 3. It is permanent until dropped 4. create [public] synonyms syn_name for [Existed database object]; like create synonym emp1  for hr.employees; Alias is 1. It is not a database object. 2. It will alway private to query 3. It temporary to that query.It to used to provide a name It is generally used to provide a meaning-full heading or column name or table name that is long or inconvenient to type in Query 4. take a example select rownum as rank,e.* from emp1 e; here rank and e is alias where as emp1 is synonym

procedure to Insert image using sql by using LOB ,BLOB,CLOB data types

Insert image using sql create or replace procedure load(filename varchar2) as f_lob bfile; b_lob blob; begin insert into images values(filename,substr(filename,instr(filename,'.')+1),empty_blob()) return content into b_lob; f_lob:=BFILENAME('PAVAN',filename); dbms_lob.fileopen(f_lob,dbms_lob.file_readonly); dbms_lob.loadfromfile(b_lob,f_lob,dbms_lob.getlength(f_lob)); dbms_lob.fileclose(f_lob); commit; end;

Steps to install AdventureWorks database in sql server

Following are Steps to install AdventureWorks database in sql server. 1. Open Object Explorer, if necessary, in SQL Server Management Studio by choosing View ->Object Explorer. 2. Expand the node for the relevant SQL Server 2005 instance and then expand the Databases node. 3. Right-click the AdventureWorks node and choose Tasks➪Copy Database. The Copy Database Wizard runs. 4. Click Next. 5. On the Select a Source Server screen, specify the location of the server and the authentication method to use. Click Next. 6. Select a destination server and click Next. 7. On the Select a Transfer Method screen, select a method to use to copy the database. (Because this is only sample data, you can use the faster detach and attach method.) Click Next. 8. On the Select Databases screen, enable the check box for the AdventureWorks database. Click Next. 9. On the Configure Destination Database screen, name the copy AdventureWorks_new. Click Next, click Next, and click Finish.

SQL Server Data Types

SQL Server Data Types Numeric data types: Can be anything from very small to extremely large numbers. Also included are specific formats such as monetary amounts, float point numbers, numbers with a known number of decimal points, whole numbers, and so on. Date and time data types: Allows the direct input of date and time values. This is usually in a default format, such as mm/dd/yyyy hh:mm, or something similar. String data types: Can be fixed length strings, variable length strings, or even very large text objects. Text objects may or may not be stored in binary format. Strings normally accept alphanumeric data. Alphanumeric characters are letters, numbers, and special characters (anything on your keyboard that is not a letter or a number). Binary data types: Typically used to store large objects, including images, sound files, video, even very large textual values like documents. SQL Server 2005 allows storage of similarly related Microsoft product types, such as directl

Default system database description of sql server

Master The master database contains system tables that define the behavior of your SQL Server 2005 system. For example, each database that you add is recorded in a system table, and you can access information about those databases by executing a SELECT statement on the sys.databases catalog view. Similarly, information about all system stored procedures is stored in the master database. model Each time you create a new database, the model database is used as the template for the database you’re creating. It’s possible, if you’re planning to create multiple databases with the same customizations, to make those customizations once in the model database. msdb SQL Agent uses the msdb database to store information about tasks. tempdb The tempdb database is the scratch pad for the SQL Server system. A new tempdb database is created each time you start SQL Server 2005. Similarly, the tempdb database is discarded when you shut SQL Server down, so if you use the tempdb database to sto

Compiling and Delivering ASP.NET Pages stages

Compiling and Delivering ASP.NET Pages stages The process of compiling and delivering ASP.NET pages goes through the following stages: 1. IIS matches the URL in the request against a file on the physical file system (hard disk) by translating the virtual path (for example, /site/index.aspx) into a path relative to the site’s Web root (for example,d:\domains\thisSite\wwwroot\site\index.aspx). 2. Once the file is found, the file extension (.aspx) is matched against a list of known file types for either sending on to the visitor or for processing. 3. If this is first visit to the page since the file was last changed, the ASP code is compiled into an assembly using the Common Language Run time compiler, into MSIL, and then into machine-specific binary code for execution. 4. The binary code is a .NET class .dll and is stored in a temporary location. 5. Next time the page is requested the server will check to see if the code has changed. If the code is the same, then the compilat

Example of SQL script injection

SQL script injection collectionstring sql= “SELECT COUNT(EmailName) FROM Users WHERE “ + “EmailName=@Username AND Password=@Password”; sqlCommandcmd= new SqlCommand(sql, connection); cmd.Parameters.Add(“@Username”, txtUsername); cmd.Parameters.Add(“@Password”, txtPassword); connection.Open(); intcount = (int)command.ExecuteScalar(); connection.Close()

ASP.NET validation controls

ASP.NET validation controls RequiredFieldValidator CompareValidator RangeValidator RegularExpressionValidator CustomValidator E.g. <asp:TextBoxid=“pwd” runat=“server”/><asp:RequiredFieldValidatorControlToValidate=“pwd”ErrorMessage=“Password required.”EnableClientScript=“true”id=“pwdRequired”runat=“server”/>

Interview Questions and Answers for Networking

Interview Questions and Answers for Networking 1. Define Network? A network is a set of devices connected by physical media links. A network is recursively is a connection of two or more nodes by a physical link or two or more networks connected by one or more nodes. 2. What is a Link? At the lowest level, a network can consist of two or more computers directly connected by some physical medium such as coaxial cable or optical fiber. Such a physical medium is called as Link. 3. What is a node? A network can consist of two or more computers directly connected by some physical medium such as coaxial cable or optical fiber. Such a physical medium is called as Links and the computer it connects is called as Nodes. 4. What is a gateway or Router? A node that is connected to two or more networks is commonly called as router or Gateway. It generally forwards message from one network to another. 5. What is point-point link? If the physical links are limited to a

Interview Questions and Answers for SQL Server

Interview Questions and Answers for SQL Server 1. What is RDBMS? Relational Data Base Management Systems (RDBMS) are database management systems that maintain data records and indices in tables. Relationships may be created and maintained across and among the data and tables. In a relational database, relationships between data items are expressed by means of tables. Interdependence's among these tables are expressed by data values rather than by pointers. This allows a high degree of data independence. An RDBMS has the capability to recombine the data items from different files, providing powerful tools for data usage. 2. What are the properties of the Relational tables? Relational tables have six properties: Values are atomic. Column values are of the same kind. Each row is unique. The sequence of columns is insignificant. The sequence of rows is insignificant. Each column must have a unique name. 3. What is Normalization? Database normalization is a d

Microsoft Silverlight 4 Development

Exam : Microsoft 70-506 Title : Microsoft Silver light 4 Development Version : Demo 1. You are developing a Silver light 4 application. You need to add a Media Element control that handles when the media has finished playing. Which XAML fragment should you use? A. <MediaElement x:Name="MediaElement1" AutoPlay="True" MediaEnded="MediaElement1_MediaEnded"f> B. <MediaElement x:Name="MediaElement1" AutoPlay="True" MediaOpened="MediaElement1_MediaOpened"f> C. <MediaElement x:Name="MediaElement1" AutoPlay=''True'' Marl<erReached="MediaElement1_Marl<erReached"f> D. <MediaElement x:Name="MediaElement1" AutoPlay=''True'' CurrentStateChanged="MediaElement1_ CurrentStateChanged" f> Answer: A 2. You are developing a Silverlight 4 application. The application contains a Person class that has a puonc nuuabte OateTime pro

Managing Microsoft Dynamics Implementations

Exam :MB5-858 Title :Managing Microsoft Dynamics Implementations Version:Demo Question: 1. You are planning a project and find that stakeholders often have varying objectives and requirements.This makes it difficult for you to summarize a plan in a way that all objectives will be identified or known in advance. Your customer communicates that they expect their business priorities to change. You are certain that this will be a single site implementation requiring specific features and complex customizations. Which implementation approach is suitable for the project? A. Standard Project Type B. Agile Project Project Type C. Enterprise Project Type D. Rapid Project Project Type Answer: B Question: 2. You are about to roll-out a new Microsoft Dynamics implementation with no customizations and very limited data migration. Which activities should you plan for in the Deployment phase? Choose the 2 that apply. A. Conduct User Training B. Finalize Configuration/Setu

Designing and Developing Microsoft SharePoint 2010

Exam : Microsoft 70-576CSharp Title : PRO: Designing and Developing Microsoft Share Point 2010 Applications Version : Demo 1. You are helping an organization’s executive team to design an automated approval process to standardize certain documents. You have the following requirements: ·The documents must be reviewed and approved by multiple teams in the approval chain. .Each reviewer must provide feedback as part of completing a review. .Each reviewer must either approve or reject the documents. .After review, the document status must be changed; an e-mail must be generated to the document author and the next reviewer in the approval chain; and a task should be created for the next reviewer in the approval chain. You must design a custom work flow solution for the document approval process on a Share Point 2010 site. What should the solution include? A. an initiation form to collect the reviewer’s feedback and a Simple activity to approve and reject the document B. a

Microsoft 70-647 Windows Server 2008 Enterprise Administrator exam paper

Exam : Microsoft 70-647 Title : Pro: Windows Server 2008,Enterprise Administrator Version : Demo 1. Your company has a main office and a new branch office. The network consists of one Active directory domain. The branch office contains two member servers that run Windows Server 2008. One of the servers is configured as a file server that hosts shared folders. An administrator in the branch office is responsible for maintaining the servers. You have a single DNS zone that is hosted on a DNS server located in the main office. A wide area network (WAN) link between the branch office and the main office is unreliable. You need to recommend a network services solution for the new branch office. The solution must meet the following requirements: Users must be able to log on to the domain if a WAN link fails. Users must be able to access file shares on the local server if a WAN link fails. Branch office administrators must be prevented from initiating changes to Active Directo

Prerequisites for Microsoft Visual Studio 2010 Express installation

Prerequisites for Microsoft Visual Studio 2010 Express installation Architectures x86, x64  Supported Operating Systems Windows XP (x86) with Service Pack 3 Windows Vista (x86 & x64) with Service Pack 2 Windows 7 (x86 and x64) Windows Server 2003 (x86 & x64) with Service Pack 2 - all editions Users must install MSXML6 if it is not already present. Windows Server 2003 R2 (x86 and x64) - all editions Windows Server 2008 (x86 and x64) with Service Pack 2 - all editions Windows Server 2008 R2 (x64) - all editions Hardware Requirements GHz or faster processor 1024 MB RAM (1.5 GB if running on a virtual machine) 3 GB of available hard-disk space 5400 RPM hard-disk drive DirectX 9-capable video card running at 1024 x 768 or higher display resolution DVD-ROM drive

Upload Image using code using c sharp dot net

This is example of c#.net code to Upload Image through image upload control and save image to table of database. using System.Data; using System.Data.SqlClient; public partial class ImageUpload : System.Web.UI.Page {     SqlConnection sqlcon=new SqlConnection(@"Server=SQLEXPRESS;database=abc;uid=xxxx;pwd=yyyy;");     SqlCommand sqlcmd=new SqlCommand();     String ImageName,ImageType;     protected void Button1_Click(object sender, EventArgs e)     {         if (FileUpload1.HasFile)         {             int len = FileUpload1.PostedFile.ContentLength;             byte[] picture = new byte[len];             ImageName = FileUpload1.FileName;             ImageType = FileUpload1.PostedFile.ContentType;             sqlcon.Open();             SqlCommand sqlcmd = new SqlCommand("insert into tesimage(ImgName,Img,ImgType) values (@Im, @Img, @ImgType)", sqlcon);             sqlcmd.Parameters.Add("@Im", ImageName);             sqlcmd.Parameters.Ad