Tuesday, February 25, 2014

Program structure

Top down Step wise Refinement
  • Start with the initial problem statement (Abstract form)
  • Break the initial statement into few general steps
  • Take each "step", and break it further into more detailed steps
  • Continue the refinement process until you get a pretty specific, pseudo code which can be easily implemented 
  • Write a Pseudo code of an algorithm outputs minimum of two numbers given by the user using Top down Step wise Refinement method.
Program Control Structures 
  • Specify the next statement to be executed 
  • Sequential Structures
  • Selection Structures
    • IF statement -Single selection
    • IF ELSE statement -Double selection
    • Nested IF ELSE 
    • Switch Statement 

Repetition Structures
  • Repeat a given statement , while some condition remains true
  • Counter Controlled repetition
    • Uses a variable counter to control the number of iterations
    • Definite repetition : the number of iterations is known before the loop begin execution 
  • Sentinel Controlled repetition
    • Uses a sentinel value (a signal value, a dummy value or a flag value) to control the number of iterations 
    • Indefinite repetition : the number of iterations is not known in advance how many times the loop will be executed
While Structure ( While Loop )
  • Test the terminating condition at the beginning of the loop
  • Loop body may not be executed at all
  • Write a program to print the all the integer numbers from 10 to 1
For Structure (For Loop)

  • Used when the number of iterations is known in advance
Do-While Structure

  • Test the terminating condition at the end of the loop
  • The statement of block of statements in the loop will be executed at least once
Infinite Loop
  • Loop which never end 
  • A while loop without increment or decrement statement 
  • A while loop with a terminating condition which always evaluates as TRUE

    Steps in Programming

    Steps in Programming

    • Every programming task have two phase
      • Design phase
      • Implementation phase 
    • Design phase
      • Identifies the problem and defines the steps “how to obtain the solution ” 
      • Algorithm -A Set of instructions (steps) to obtain a solution for a computational problem 
    • Implementation phase 
      • Implement the designed algorithm (procedure) in selected programming language
    Flow Chart

    • A graphical representation of steps of a procedure (computer program)
    • Made up of rectangles, diamonds and other shapes connected with arrows
    • Arrows indicate the flow of the procedure
    Flow Chart : Symbols
    Flow Chart : Rules
    • All symbols of the flowchart are connected by flow lines (note arrows, not lines) 
    • Flow lines enter the top of the symbol and exit out the bottom, except for the Decision symbol, which can have flow lines exiting from the bottom or the sides
    • Generally flow charts flow from top to bottom 
    • The beginning and the end of the flowchart is indicated using the Terminal 
    • Connectors are used to connect breaks in flow chart
    Pseudo Code
    • Pseudo code is an informal language that helps programmers develop and represent algorithms
    • Very similar to everyday English
    • Can not be executed in a Computer
    • However, a carefully prepared Pseudo code can be easily implemented in a programming language

    Example 
    • A Pseudo code of an algorithm to calculate and display the average of two integer number given by the user
    • Steps
      • Declare and initialize variables
      • Input values for variable
      • Calculation 
      • Display the result
    Answer




    Programming Paradigms


    • Structured Oriented Programming
      • each block of code performs a distinct operation 
      • keeps data inside (local) or outside (global) of the procedures
    • Object Oriented Programming
      • gathers together procedures and their associated data into a class
    • Functional Programming 
      • Used in purely mathematical disciplines
    • Logic Programming 
      • Knowledge representation and making inferences
    Basic Terms in Programming
    • Data types 
      • Numeric
      • Characters –String
      • Boolean –True / False
    • Operations 
      • Arithmetic Operators 
      • Logical Operators
      • Relational Operators 
      • Bitwise Operators ( & , | , ~ , >>, <<) 
    • Identifiers
      • Variables
      • Constants
    • Function –a section of code that performs a specific task
      • add ( Integer X, Integer Y) -returns X+Y
    • Syntax -how program is formed
      • Grammatical rule in language that defines how to perform expressions and combine them 
    • Semantics –what program does
      • Meaning of an expression or a program

    Generations of Programming Languages


    • 1st generation -1GL
      • machine language
      • instructions coded using combinations of 0’s & 1’s
    • 2nd generation –2GL
      • assembly languages (low-level symbolic languages)
      • for each different instruction, have an associated short, human-meaningful acronym or name
      • one assembly language instruction is translated into one machine language instructionGenerations of Programming Languages
    • 3rd generation –3GL
      • high-level symbolic languages
      • one instruction generates multiple machine language instructions 
      • makes complex programming simpler and easier to read, write and maintain
      • BASIC , Fortran , C , C++ , Java , C# 
    • 4th generation -4GL
      • Very High level languages to develop software for specific purposes 
      • Non-procedural languages -what you want, not how to get itSQL, NOMAD and FOCUS
    • 5th generation -5GL
      • Languages used develop systems to mimic human experts 
        • Prolog , LIPS
        • Knowledge-base systems + inference engine
          • Root planning Systems
          • Medical Expert Systems 
      • Inference processing
      • Knowledge representations 
      • Used in Artificial Intelligence

    Program

    What is a program?

    • A set of instructions that execute on computer to perform a particular task
    • Instructions that run on CPU are in machine code
    • instructions that are encoded in binary (1s and 0s)
    • Human can not understand machine code directly 
    • But human can write programs in machine code
    • A tedious, time consuming and very error prone task
    • Need computer programming languages –to write a human readable code (source code) which can be converted into machine code
    Solution

    • Assembly Languages 
      • Sets of binary digits are replaced by mnemonics (ADD, MOV)
      • Not user friendly, but easier than machine code
      • It is hard to understand another person’s assembly language programs
    • Assembler: translates mnemonics into machine code
    • Assembly languages are second generation languages
    • Machine code and Assembly languages are low-level programming languages
    • Programming in low-level languages required expertise in the field 
    • High level programming languages allow to write programs in English-like symbols 
      • write algorithms in a human-friendly notation
      • allow thinking at a higher level of abstraction than assembly or machine language supports
    • Third generation languages
    • Need to convert code in high level languages into machine code 
      • Compiler
        • translates the whole source code in to machine code at once
        • checks syntax errors 
        • produces an executable machine code (Machine dependent)
          • C, C++ , Java
      • Interpreter 
        • convert the source code of a program line by line to machine coed while the program is running
      • Compilers VS Interpreters
        • Compiler produces machine dependent MC at once 
        • Interpreter executes source code line by line in every execution of the program 
        • Compiler produces optimize MC that run faster on hardware 
        • Interpreter might execute a program slower than the compiled machine code for the same program 
        • It is easy to point out errors in a program with an Interpreter (Easy to debug)

    Hexadecimal Number System


    • A Base 16 number system
    • There are 16 symbols that represent quantities:
    • 0 -9 and A = 10 , B = 11 , C = 12 , D = 13, E = 14 , F = 15
    • Each place value in a hexadecimal number is a power of 16
      • 163, 162, 161, 160
    Conversion from decimal to hexadecimal

    Conversion from binary to hexadecimal
    • Starting with the LEAST SIGNIFICANT digit, mark off the digits in groups of 4
    • Convert each group of four digits to its hexadecimal number
    • Ex: Convert 111001112 to Hexadecimal

            0000    1110     01112
             0            D       7
    • 111001112=D716


    Octal Number System

    • A Base 8 number system
    • There are 8 symbols that represent quantities,
    • 0-7
    • Each place value in a octal number is a power of 8
      • 83, 82, 81, 80
    Conversion from binary to octal

    • Starting with the LEAST SIGNIFICANT digit, mark off the digits in groups of 3
    • Convert each group of three digits to its octal number
    • Ex: Convert 11001112 to octal 

            001     100    1112
             1         4         7

    • 11001112=1478


    Binary Number System

    • A Base 2 number system
    • There are 2 symbols that represent quantities,
      • 0 and 1
    • Each place value in a binary number is a power of 2
      • 23, 22, 21, 20
    • 5710 to binary
     
    • Convert 0.437510to binary


         Convert 11001112 to Decimal
    26
    25
    24
    23
    22
    21
    20
    1
    1
    0
    0
    1
    1
    1
    64
    32
    16
    8
    4
    2
    1
      • 11001112=26x1+25x1+24x0+23x0+2x1+21x1+20x1
      • 11001112=6410+3210+410+210+110
      • 11001112=10310  
    Convert 0.110112 to Decimal
    2-1
    2-2
    2-3
    2-4
    2-5
    1
    1
    0
    1
    1
    64
    32
    16
    8
    4
    •            0.110112=2-1x1+2-2x1+2-3x0+2-4x1+2-5x1
    •            0.110112=0.510+0.2510+0.062510+0.0312510
    •      0.110112=0.8437510 



    Number Systems


    • A system that used to represent numerical values 
    • The base value (radix) of a number system determines
    • The number of symbols in the system
    • The place value of each digit 
    • Number systems
      • Decimal –base 10 (0,1,2,3,4,5,6,7,8,9)
      • Binary –base 2 (0,1)
      • Octal –base 8 (0,1,2,3,4,5,6,7)
      • Hexadecimal –base 16 (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)

    SQL - கேள்வி பதில் பகுதி - 7

    Q 61. Explain the call stack.

    A. The call stack shows you which functions the code called to bring you to a specific point in code execution.

    Q 62. Explain the difference between Windows Only authentication and SQL Server and Windows (Mixed) authentication.

    A. With Windows authentication the user does not need to log on to the server more than one time. Users you add to the SQL Server then gain the specified access to the server. With Windows authentication, you also get all the benefits of the operating system login process. For example, you can enforce minimum password length.

    With SQL Server and Windows (Mixed) Authentication you can use SQL Server logins on the Windows 9x platform. You do not have to have organized Windows domains, and finally, SQL Server and Windows (Mixed) authentication enables you to support non-Windows users such as Novell users.

    Q 63. Explain the SA login and what it can do.

    A. The SA login is available only with Mixed Authentication. The SA login has unlimited powers! There is no way to modify or delete the SA account. It is therefore imperative that you assign a password to the SA account. Otherwise, any other security measures you take will be futile.

    Q 64. Explain the interaction between sysadmin and the Windows Administrators group.

    A. All members of the Windows Administrators group are added automatically to the sysadmin role upon installation of SQL Server. Remember that sysadmin is all-powerful in working with your server. Fortunately you can remove this mapping. You must first deny the Administrators group from logging on to the SQL Server. You then grant the individual users membership to the sysadmin role as required.

    Q 65. Explain inherited permissions.

    A. Inherited permissions refer to rights that a user has to an object because he is a member of a role that has rights to that object, or because he is the owner of the object.

    Q66. Explain the difference between WITH GRANT and DENY permissions.

    A. WITH GRANT permissions revoke permission for an object unless that user is a member of a role that has rights to that object. DENY permissions revoke permission so that permission for an object cannot be inherited.

    Q 67. Describe CONTROL permissions.

    A. With CONTROL permissions the user or role has ownership-like capabilities for the object. The user can administer the object and has permission to all objects within it.

    Q 68. Why is memory so important to a SQL Server?

    A. SQL Server uses memory to hold all data pages, index pages, and log records. It also uses memory to hold compiled queries and stored procedures.

    Q 69. Explain some of the security options available.

    A. Using the Security page of the Server Properties dialog, you can change the type of authentication that you want to allow (Windows only versus Windows and SQL Server). You can also determine what type of logging SQL Serve will perform when logins are unsuccessful.

    Q 70. Name and describe the three recovery models.

    A. The Full recovery model enables you to restore all committed transactions. With this option, SQL Server backs up both the database and the log file. With the Bulk Logged recovery model, logging is minimal. You get the best performance while using the least memory, but with the minimal recovery. The Simple recovery model loses all data since the last backup. With this model you can recover data only as of the last backup.

    Q 71. Name the query analysis tool that shipped with SQL 2000, and compare it to what is available in SQL Server 2005 Express.

    A. SQL Server 2000 provided a tool called the Query Analyzer. This tool is now built into SQL Server Management Studio Express.

    Q 72. Explain why you will probably want to analyze the queries that you include in your stored procedures, functions, etc.

    A. Using the analysis tools built into SQL Server Management Studio Express, you can analyze your T-SQL statements to ensure that they execute as efficiently as possible. You can modify your queries at will, and observe the effect that those changes have on performance.

    SQL - கேள்வி பதில் பகுதி - 6

    Q 51. Explain why you might want to use a temporary table.

    A. Temporary tables enable you to perform operations on data as if that data were structured differently than it actually is. For example, using temporary tables, you can join two tables, have the result go to a temporary table, sort the results, and then send the results back to SQL Server. The temporary table is in memory only, so its structure does not have to be stored anywhere.

    Q 51. Explain why error handling is useful.

    A. Without error handling, you get the default error handling associated with Visual Basic .NET. This default error handling is probably not what you want. Using custom error handling you can control exactly what happens when an error occurs.

    Q 52. Give an example of where transaction processing may be useful.

    A. Transaction processing would be helpful, for example, for an airline ticket processing system. If processing is interrupted during the booking of a flight, you would not want a partial transaction to be entered into the system. Using transaction processing, you ensure that the entire transaction is completed or the processing that has occurred is rolled back.

    Q 53. Discuss the process of building and executing a C# stored procedure.

    A. You must first write the stored procedure in the C# language within a Visual Studio 2005 class. You then build the project. You must then declare the stored procedure within SQL Server Management Studio Express. Finally, you can execute it just as you would any other stored procedure.

    Q 54. Explain what the keyword Switch does.

    A. The keyword Switch enables you to evaluate a variable and test its value against several conditions, executing the appropriate code based on the satisfied condition.

    Q 55. Describe the purpose of input parameters.

    A. Input parameters enable you to supply information to a stored procedure.

    Q 56. Explain why you might want to use a temporary table.

    A. Temporary tables enable you to perform operations on data as if that data were structured differently than it actually is. For example, using temporary tables, you can join two tables, have the result go to a temporary table, sort the results, and then send the results back to SQL Server. The temporary table is in memory only,  so its structure does not have to be stored anywhere.

    Q 57. Explain why error handling is useful.

    A. Without error handling, you get the default error handling associated with C#. This default error handling is probably not what you want. With custom error handling you can control exactly what happens when an error occurs.

    Q 58. Give an example of where transaction processing may be useful.

    A. Transaction processing would be helpful, for example, for an airline ticket processing system. If processing is interrupted during the booking of a flight, you would not want a partial transaction to be entered into the system. Using transaction processing, you ensure that the entire transaction is completed or the processing that has occurred is rolled back.

    Q 59. Explain the difference between a breakpoint and a watch.

    A. A breakpoint is an unconditional point at which you want to suspend code execution, whereas a watch is a condition under which you want to suspend code execution.

    Q 60. Explain the difference between Step Into, Step Over, and Step Out.

    A. Step Into executes code one line at a time. You use Step Over to execute a subroutine or function without stepping through its code. Finally, you use Step Out to execute the remainder of a subroutine or function without stepping through its code. You return to the procedure that called the subroutine or function in which you were.

    Monday, February 24, 2014

    SQL - கேள்வி பதில் பகுதி - 3

    Q 21 Explain what a full join is.

    A A full join combines the behavior of a left outer join and a right outer join. An example is where you show all customers whether or not they have orders, and all orders whether or not they are associated with a customer.

    Q 22 Explain the difference between the HAVING clause and the WHERE clause.

    A SQL Server Express applies the HAVING clause after it summarizes the data, whereas it applies the WHERE clause before it summarizes the data.

    Q 23  Describe a subquery.

    A SQL Server Express evaluates a subquery before it evaluates the main query.

    Q24  Explain the difference between INSERT and SELECT INTO.

    A INSERT adds data to an existing table, whereas SELECT INTO creates a new table containing the data that you are inserting.

    Q 25 Explain the difference between a DELETE statement and a trUNCATE statement.

    A A DELETE statement enables you to selectively remove data from a table, whereas the TRUNCATE statement unconditionally removes all rows from a table.

    Q 26 Describe the difference between trUNCATE and DROP.

    A trUNCATE removes all data from the table while retaining the table structure, whereas DROP removes the table from the database.

    Q 27 Explain what the STUFF function does.

    A The STUFF function starts at a certain position and replaces a specified number of characters with other specified characters.

    Q 28 Explain what the DATEPART function does.

    A The DATEPART function extracts part of a date. You designate the part of the date you want to extract, and the date from which you want to extract it.

    Q 29 Explain the ISNULL function.

    A The ISNULL function returns information about whether the value in an expression is null. It receives the expression that you want to evaluate, and the value that you want to return if the expression is null. It returns the specified value.

    Q 30. Name some advantages of views.

    A. Views enable you to join data, aggregate data, customize data to the user's needs, hide underlying column names from users, limit the columns and rows that a user works with, and easily secure data.

    SQL - கேள்வி பதில் பகுதி - 1

    Q 1 Explain the difference between system objects and user objects.

    A. SQL Server creates system objects during the installation process. They are part of the system, and most of them are necessary for SQL Server to function properly. Whereas system objects are part of the SQL Server system, you create user objects. User objects include the databases, stored procedures, functions, and other system objects that you build.

    Q2 . Describe normalization.

    A. Normalization is the process of applying a series of rules to ensure that your database achieves optimal structure. Normal forms are a progression of these rules. Each successive level of normal form achieves a better database design than the previous one. It is generally sufficient to apply the first three levels of normal forms to your data.

    Q 3 . What is the difference between a DDL trigger and a DML trigger?

    A. A DDL trigger executes in response to a change to the structure of a database (for example, CREATE, ALTER, DROP). A DML trigger executes in response to a change in data (INSERT, UPDATE, DELETE).

    Q 4. Discuss the advantages of SQL Server 2005 Express.

    A. SQL Server 2005 Express is free and is easy to use. It provides the same protection and information management provided by more sophisticated versions of SQL Server. It is easy to install, provides rich database functionality, and sports deep integration with Visual Studio 2005.

    Q 5. Name some limitations of SQL Server 2005 Express.

    A. SQL Server 2005 Express limits you to one gigabyte of RAM, a four-gigabyte maximum database size, and support for only one CPU. Furthermore, it does not come with either a job scheduling server or a database tuning advisor.

    Q 6. Name some advantages of SQL Server 2005 Mobile Edition.

    A. SQL Server 2005 Mobile Edition enables you to port applications to mobile devices. It provides full integration with SQL Server 2005, and even includes synchronization functionality. It offers excellent reliability and performance, as well as multi-user support. Finally, it provides full integration with Visual Studio 2005 and increased device support.

    Q 7. Explain what the Master database is used for.

    A. The Master database is the database of all databases. It keeps track of all the login accounts, linked servers, system configuration settings, and more. It also contains initialization settings for SQL Server.

    Q 8. Explain how you utilize the Model database.

    A. Model is a very special database. Any objects that you place in Model propagate automatically to any new databases that you create. This provides standardization as well as rapid application development.

    Q 9. Describe MSDB and what it does.

    A. MDSB stores data, including scheduling information and backup and restore history information.

    Q 10. What is the difference between a check constraint and a rule?

    A. Both check constraints and rules limit the range of values that a user can enter into a column. Whereas check constraints apply only to the table for which you enter them, you can apply rules to multiple tables.

    SQL - கேள்வி பதில் பகுதி - 5

    Q 41. Describe the parameters used when a stored procedure is used to insert data.

    A. You generally have one input parameter for each field in the underlying table. It is also common to have output parameters that return error and status information, as well as the identity value of the row that the stored procedure inserted.

    Q 42 . Why would you create temporary tables?

    A. You create temporary tables to share data between procedures or to help you to accomplish complex tasks.

    Q 43 . Explain what a trigger is.

    A. A trigger is like an event procedure that runs when data changes. You create triggers that respond to inserts, updates, and deletes.

    Q 44. Explain why you use triggers.

    A. Developers use triggers to enforce business rules and even to perform tasks such as inserting data into any audit log.

    Q 45. Explain why ADO.NET is superior to its predecessors.

    A. ADO.NET is superb at dealing with disparate data formats and scalability in enterprise situations. It provides one programming model for accessing all types of data, no matter in what format it is stored and where it is stored. It utilizes XML to accomplish this task. Finally, ADO.NET is focused on disconnected operations, contributing to its scalability.

    Q 46. Name four methods of the SqlCommand object and explain what they do.

    A. The ExecuteReader method returns a forward-only DataReader object. The ExecuteScalar method returns a result of one column and one row. The ExecuteNonQuery method returns no results (you use it, for example, to update data). The ExecuteXLMReader method returns an XML version of a DataReader object.

    Q 47. Explain the benefits of the SqlDataReader object.

    A. It provides the fastest means for retrieving read-only sets of data. It supplies a forward-only, read-only, server-side cursor, loading only what it needs into memory.

    Q 48. Discuss the process of building and executing a Visual Basic .NET stored procedure.

    A. You must first write the stored procedure in the Visual Basic .NET language within a Visual Studio .NET class. You then build the project. You must then declare the stored procedure within SQL Server Management Studio Express. Finally, you can execute it just as you would any other stored procedure.

    Q 49 . Explain what logical flow is within a stored procedure.

    A. Logical flow is when you want to react differently within a stored procedure depending on certain situations. For example, you may want to respond in a special manner if a parameter is passed in as NULL.

    Q 50. Describe the purpose of output parameters.

    A. Output parameters enable you to supply information back to the calling program about what happened within the stored procedure.

    SQL - கேள்வி பதில் பகுதி - 4

    Q 31. Explain why you would want to join data so that users can easily work with it.

    A. A normalized database is not always easy for the user to work with. For example, only the CustomerID is  stored in the Orders table. The Company Name is stored in the Customers table. To see both the Customer and Order information, the user must join the tables. Using a view, you can join the tables for the user, so that the user can work with the view as if it were a single table.

    Q 32. Explain what it means to customize data to a user's needs.

    A. Using a view, you can create a column that combines first, middle, and last name of an employee, or the city, state, and zip code from an address. This makes it much easier for the user to work with this data.

    Q 33. How do views help you to secure data?

    A. You can grant rights to logins and roles to the views that you create. It is not necessary to grant rights to the underlying tables. In this way you can give users access to just desired columns and rows. For example, you can give users rights to name and address data for the sales department in the employee table.
    Q 34 Explain what an indexed view is and why it is beneficial.

    A With indexed views, you provide a unique, clustered index for a view. This means that SQL server stores the data in the designated order at the time that you save the view. It updates the index as you add, update, and delete data. Therefore, there is no need for SQL Server to create a result set dynamically each time the view is referenced.

    Q 35 Describe the benefits of user-defined functions when working with views.

    A User-defined functions enable you to pass parameters to functions as if they were stored procedures, but to work with the results as if they were views.

    Q 36 Explain how you can use a view to secure data.

    A You first create a view containing the appropriate columns. You then give the users rights to the view. Although they have no rights to the underlying tables, they are able to work with the data displayed in the view.

    Q 36. What happens if you forget to use BEGIN and END with the IF...ELSE...ENDIF construct?

    A. If you forget to place a BEGIN...END construct on the line immediately following the IF statement or the ELSE statement, only the first statement after the IF or the ELSE executes.

    Q 37. What does the RETURN statement do?

    A. The RETURN statement unconditionally exits a stored procedure without executing any other statements.

    Q 38. Why would you use the CASE statement?

    A. You use the CASE statement to compare a result from a SQL statement against a set of simple responses. For example, a CASE statement might evaluate the contents of the ContactTitle field and return an appropriate string based on those contents.

    Q 39. Why would you use the SET NOCOUNT statement?

    A. When it is set to ON, SET NOCOUNT eliminates the xx row(s) affected message in the SQL Express Manager window and the DONE_IN_PROC communicated from SQL Server to the client application. This improves the performance of the stored procedure.

    Q 40. The @@ functions are actually variables (true/false).

    A. False. You cannot assign values to them or work with them like normal variables. They are instead functions that return information about SQL Server.

    SQL - கேள்வி பதில் பகுதி - 2

    Q 11. Explain what a primary key is, and describe the ideal criteria for a primary key.

    A. A primary key is a column or a set of columns that uniquely identify a row in a table. A primary key should be short, stable, and simple.

    Q 12. Describe a foreign key and indicate how many foreign keys each table can contain.

    A. A foreign key constraint consists of a column or a set of columns that participate in a relationship with a primary key table. The primary key is on the one side of the relationship, whereas the foreign key is on the many side of the relationship. A table can have multiple foreign keys.

    Q 13. What is the Tables and Columns specification?

    A. The Tables and Columns specifications enable you to designate the foreign key table that will participate in the relationship, the field in the foreign key table that will participate in the relationship, and the field in the current table that will participate in the relationship.

    Q 14. Describe three uses of a one-to-one relationship.

    A. You use a one-to-one join when the number of fields required for a table exceeds the number of fields allowed in a SQL Server table, when certain fields that are included in a table need to be much more secure than other fields included in the same table, or when several fields in a table are required for only a subset of records in the table.

    Q 15. Describe a many-to-many relationship and how you create one.

    A. With a many-to-many relationship, records in both tables have matching records in the other table. You cannot create a many-to-many relationship directly. You must develop a junction table and relate the junction table to each of the two tables in one-to-many relationships.

    Q16. Why do you use a SELECT statement?

    A . You use the SELECT statement to retrieve data from one or more tables.

    Q 17. Name the wildcard characters that you can use when searching, and explain the differences between them.

    A. The two wildcard characters are the percent (%) sign and the underscore (_). T-SQL uses the percent symbol as the wildcard for zero or more characters. The underscore (_) is the wildcard for a single character.

    Q 18. Explain the DISTINCT keyword.

    A. The DISTINCT keyword ensures uniqueness of values in the column or combination of columns included in the query result.

    Q 19. Why would you use a Top Values query?

    A. You use a Top Values query to limit the number of rows that appear in the output.

    Q20 Why must you join tables together in a query?

    A When you build a system based on normalized table structures, you must join the tables back together to see the data in a useable format.