Preview

dbms notes

Powerful Essays
Open Document
Open Document
2145 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
dbms notes
INDEX
1. SQL BASICS

The Structured Query Language (SQL) is a language that enables you to create and operate on relational databases, which are sets of related information stored in tables.

The basic structure of a SQL expression consists of three clauses:
Select
From
Where

SELECT:- The select clause is used to list the attributes desired in the result of a query. It corresponds to the projection operation of the relational algebra.

FROM:- The from clause lists the relation to be scanned in the evaluation of the expression. It correspond to the Cartesian product operation of the relational algebra.

WHERE:- The where clause consists of a predicate involving attributes of the relations that appear in the from clause.

A TYPICAL SQL QUERY HAS THE FORM:- Select A1,A2………,An from r1,r2………...,rm where P

Here, Each Ai represents to an attribute. Each ri represents a relation. P is the predicate. 2. PROGRAM TO CREATE TABLE

SYNTAX:
CREATE TABLE
( (), ());

Create the table described below:
Table Name: CLIENT_MASTER

COLUMN NAME
DATA TYPE
SIZE
CLIENTNO
VARCHAR2
6
NAME
VARCHAR2
20
CITY
VARCHAR2
15
PINCODE
NUMBER
8
STATE
VARCHAR2
15
BALANCEDUE
NUMBER
10

SQL> CREATE TABLE CLIENT_MASTER 2 ( CLIENTNO VARCHAR2(6), 3 NAME VARCHAR2(20), 4 CITY VARCHAR2(15), 5 PINCODE NUMBER(6), 6 STATE VARCHAR2(10), 7 BALANCEDUE NUMBER(10));

Table created.

SQL> DESC CLIENT_MASTER; Name Null? Type ----------------------------------------- -------- ---------------------------- CLIENTNO VARCHAR2(6) NAME VARCHAR2(20) CITY VARCHAR2(15) PINCODE NUMBER(6) STATE



References: SQL> ALTER TABLE EMP 2 ADD CONSTRAINT S SALARY CHECK (SALARY >1000);

You May Also Find These Documents Helpful

  • Good Essays

    The SELECT statement is the primary means of extracting data from database tables, and allows you to determine exactly which data you want to extract by means of different comparison operators used in the WHERE clause. This includes the use of specific "wild card" characters which allow you to search for character or number patterns within the data. You can also perform mathematical expressions within the SELECT statement to create derived output. The ORDER BY clause allows you to sort the output data in either ascending (the default) or descending order. Lab #5 will explore all of these applications of the SELECT statement.…

    • 1559 Words
    • 7 Pages
    Good Essays
  • Satisfactory Essays

    Homework Unit 3

    • 354 Words
    • 2 Pages

    5. OR operator- Creates an expression that is true when with of the expressions are true.…

    • 354 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    SEQUEL or SQL is a data language that provides benefits for all types of users. SQL’s purpose is to provide an interface to a relational database such as Oracle Database. Dr. Edgar Frank “Ted” Codd introduced the first commercially available implementation of SQL. Today, SQL is accepted as the standard RDBMS language. The features of SQL include processing sets of data as groups rather than as individual units and providing automatic navigation to the data. It uses statements that are complex and powerful individually, and that therefore stand alone. Flow-control statements were not part of SQL originally, but they are found in the recently accepted optional part of SQL. Flow-control statements are commonly known as "persistent stored modules" (PSM), and the PL/SQL extension to Oracle SQL is similar to PSM.…

    • 452 Words
    • 2 Pages
    Good Essays
  • Powerful Essays

    Nt1310 Unit 1

    • 4209 Words
    • 17 Pages

    It parses and also executes the statement Displays the execution plan for the select statement automatically…

    • 4209 Words
    • 17 Pages
    Powerful Essays
  • Satisfactory Essays

    cis3730_Exam1_Studyguide

    • 512 Words
    • 2 Pages

    Understand the three components of a basic select statement and what do they mean (select, from, where).…

    • 512 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Unit 6 True

    • 287 Words
    • 1 Page

    SQL is the programming language used to manipulate data and data objects in a relational database management system. TRUE…

    • 287 Words
    • 1 Page
    Satisfactory Essays
  • Good Essays

    One benefit of a relational database management system is that it contains a built-in query language, which lets you obtain immediate answers to the questions you ask about your data. _________________________…

    • 585 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    3. Why do you think cross joins are allowed as a legitimate join? What uses can you see for joins?…

    • 337 Words
    • 1 Page
    Satisfactory Essays
  • Satisfactory Essays

    Structured Query Language (SQL) is a standard database computer language used for querying, modifying and managing data in Relational Database Management Systems (RDBMS). SQL was developed in the 1970's by IBM to initially manipulate and retrieve data in IBM System R. The SQL language was standardized in 1986 by the American National Standards Institute (ANSI); however, later releases were released as International Organization for Standardization (ISO) standards.…

    • 612 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    unit 6

    • 360 Words
    • 2 Pages

    1) SQL is the programming language used to manipulate data and data objects in a relational database management system.…

    • 360 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    A database language must enable the user to perform complex queries designed to transform the raw data into useful information.…

    • 1917 Words
    • 8 Pages
    Powerful Essays
  • Good Essays

    "SQL Sql Database Language Data Standard Query Programming Set." Business, Economy, Market Research, Finance, Income Tax Informations. N.p., n.d. Web. 26 Sept. 2012. <http://www.economicexpert.com/a/SQL:programming:language.htm>.…

    • 701 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Relational Database Paper

    • 547 Words
    • 3 Pages

    The purpose of a query is to retrieve information from a table or tables, which can be based on some type of criteria. To put it simply, a query is designed to get you an answer from data already stored in the database.…

    • 547 Words
    • 3 Pages
    Satisfactory Essays
  • Better Essays

    JDBC using MySQL

    • 10167 Words
    • 41 Pages

    ////////////////////////////////////////////////////////////////////////////////////////////////// CREATE DATABASE Company; USE Company; CREATE TABLE Customer( id VARCHAR(6) NOT NULL, name VARCHAR(30), address VARCHAR(30), salary DECIMAL(10,2), CONSTRAINT PRIMARY KEY (id) )ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE Orders( id VARCHAR(6) NOT NULL, date DATE, customerId VARCHAR(6) NOT NULL, CONSTRAINT PRIMARY KEY (id), CONSTRAINT FOREIGN KEY(customerId) REFERENCES Customer(id) )ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE Item( code VARCHAR(6) NOT NULL, description VARCHAR(50), unitPrice DECIMAL(8,2), qtyOnHand INT(5), CONSTRAINT PRIMARY KEY (code) )ENGINE=InnoDB DEFAULT CHARSET=latin1; CREATE TABLE OrderDetail( orderId VARCHAR(6) NOT NULL, itemCode VARCHAR(6) NOT NULL, qty INT(11), unitPrice DECIMAL(8,2), CONSTRAINT PRIMARY KEY (orderId,itemCode), CONSTRAINT FOREIGN KEY (orderId) REFERENCES Orders(id), CONSTRAINT FOREIGN KEY (itemCode) REFERENCES Item(code) )ENGINE=InnoDB DEFAULT CHARSET=latin1; ///////////////////////////////////////////////////////////////////////// INSERT INTO Customer VALUES( 'C001 ', 'Danapala ', 'Panadura ',54000);…

    • 10167 Words
    • 41 Pages
    Better Essays
  • Satisfactory Essays

    Sudhakar

    • 1718 Words
    • 7 Pages

    1. Consider the following table named "GYM" with details about Fitness products being sold in the store.…

    • 1718 Words
    • 7 Pages
    Satisfactory Essays

Related Topics