Creating SQL Tables and using Data Types

Size: px
Start display at page:

Download "Creating SQL Tables and using Data Types"

Transcription

1 Creating SQL Tables and using Data Types Aims: To learn how to create tables in Oracle SQL, and how to use Oracle SQL data types in the creation of these tables. Outline of Session: Given a simple database design, decide on suitable data types for all the columns in all the tables of the database. Create the tables using Oracle SQL. Decide what columns must never be allowed to have data missing, and re-create the tables accordingly. From the results of the earlier exercise to determine what sort of data would be needed to run a club or society, decide on 2 specific relations of those discussed, and create SQL tables to represent those relations.

2 A SIMPLE DATABASE Over the course of this module we will be developing a relational database to represent the activities of a small company which runs various Projects and which has its Employees organised into Departments. Thus we want to create in the database a relation to hold all the related data about Projects, another relation to hold all the related data about Employees, and a third relation to hold all the related data about Departments. Note that SQL uses the term tables for relations, row for tuple and column for attribute, although strictly speaking, the SQL terms do not always mean exactly the same as the relational terms. When differences arise, they will be mentioned. So to create a database, we will actually need to create tables and specify the columns that the tables contain. Consider the information below, which describes what data we want to hold in the Employees, Departments and Projects tables respectively : Table Name Column Name Description Data type EMP EMP_NO A two-character code, not necessarily both digits. EMP_NAME The Employee s surname: up to 10 letters. SALARY Whole number of pounds. MARITAL_STATUS A one-character coded value. DEPT DEPT_NO A two-character code, not necessarily both digits. DEPT_NAME Name of this Department: up to 10 letters. MANAGER_NO The Employee Number of the Manager of this Department. BUDGET Whole number of pounds. PROJ PROJ_NO A two-character code, not necessarily both digits. START_DATE The date when the Project started. DEADLINE Date when the Project must be completed. Exercise: Fill in the right-hand column above with suitable SQL data types. Decide in principle what kind of data should be stored in each column. Then decide what kind of Oracle SQL data type serves your purpose. (You will need to look up available types in an Oracle SQL reference). 2

3 SQL SYNTAX School of Computing, Engineering and Information Sciences As with other programming languages, there is a precise set of rules governing the syntax (grammar) of SQL. We will present examples of SQL syntax as and when they are needed in this and succeeding exercises. As each SQL construct is introduced, a box containing details of its makeup will be displayed, according to the following conventions: CAPITALS denote reserved words (i.e. part of the vocabulary of SQL with particular meaning within the language). <Angled brackets> contain the name of a syntactic construct that is described elsewhere. underlined italics denote the name of some object within the database (e.g. a table or column name), or a numeric or character-string value as appropriate. Character strings or patterns must be enclosed in single quotation marks. A pattern is similar to a character string but may contain the wild-card characters % (percent) and _ (underscore). Character strings are also known as literals or string constants. [square brackets] denote an optional item. {<option 1> <option 2> <option 3>} vertical bars separate alternative items enclosed by curly brackets (braces). Only one of the alternatives is to be used. The braces may be omitted where the meaning is clear. [ etc.] indicates that the construct immediately before the square brackets may, optionally, be repeated any number of times. If a separator is required it will be shown like this [, etc.] When devising Data Names (e.g. names for tables or columns) remember they must start with a letter, the rest of the name being optionally a mixture of letters, digits and the (hyphen) and _ (underscore) characters. SQL statements run continuously until terminated by a semi-colon, but it can be useful to break a statement into several lines to enhance readability. 3

4 CREATING TABLES IN ORACLE SQL provides a CREATE TABLE statement for setting up database tables. As a minimum, this requires us to give the table a name and then to specify for each column of the table: its name; the data type of the data values that it is to contain. In its simplest form, the CREATE TABLE statement has the syntax CREATE TABLE table-name ( <column definition> [, etc.] ) ; Following the reserved words CREATE TABLE, the actual name of the table must be supplied. This is followed by a pair of (round) brackets containing one or more instances, separated by commas, of a column definition. The statement ends (as do other SQL statements) with a semi-colon. A column definition, in its simplest form, has the syntax column-name <data type> In plain English, what does this syntax definition mean? The most commonly used data types in Oracle SQL are: INTEGER, i.e. a whole number (which may have a positive or negative value) DECIMAL. This requires you to specify firstly the precision (number of significant figures) and then the number of decimal places e.g. DECIMAL (7, 2) CHAR, i.e. a string of characters. It is necessary to specify the number of characters to be held, e.g. CHAR(10). If less than 10 characters (in this example) are used, then Oracle will add sufficient space characters onto the end of the string such that there is a total of 10 characters. VARCHAR2 1, i.e. a variable length string of characters. It is necessary to specify the maximum number of characters that could be held, e.g. VARCHAR2(10). If less than 10 characters (in this example) are used, then no extra space characters are added. 1 The 2 in VARCHAR2 indicates that it is Oracle s second version of the variable length character type. It has no relevance to how many characters may or should be held in the character string. 4

5 DATE, which will be formatted according to a standard convention. You should now be able to create all three tables, EMP, DEPT and PROJ. To get you started, here is the SQL code for creating the EMP table. You should enter the following code into Oracle, and then try the same procedure for the DEPT and PROJ tables. (Remember, you do not need to enter the line numbers!) SQL> CREATE TABLE EMP( 2 EMP_NO CHAR(2), 3 EMP_NAME VARCHAR2(10), 4 SALARY INTEGER, 5 MARITAL_STATUS CHAR(1) 6 ); EDITING SQL STATEMENTS During the course of entering these 3 tables into your database, make a point of learning how to edit SQL statements, both by means of the copy, cut and paste facilities provided by the Oracle DBMS interface, and by means of the editor built into the interface. (Note that this interface is proprietary to Oracle, and therefore may be quite different to those of other SQL DBMSs). CHECKING YOUR WORK Assuming that your CREATE TABLE statements were syntactically correct, Oracle will have replied to each with the message Table created. However, this is not really sufficient; you need to be able to check that the column names and data types are as you intended. It is possible to do this by means of the DESCRIBE command. This is not an SQL statement but a command which is specific to Oracle, and it does not need a semi-colon after it. Here is an example of its use : SQL> DESCRIBE EMP Name Null? Type EMP_NO CHAR(2) EMP_NAME VARCHAR2(10) SALARY NUMBER(10) MARITAL_STATUS CHAR(1) 5

6 Exercise: Some of the data types shown in the output from DESCRIBE will differ somewhat from what you originally typed in. What examples of this can you find? This is because the data types used by Oracle differ somewhat from those stipulated by the SQL Standard. Nevertheless Oracle does recognise the Standard data types, and these are what we are recommending you to use. If at any time you want to check what tables you have in your database, you can use the following SQL statement : SELECT * FROM cat ; This will give you a list, by table name, of all the tables in your database. cat is short for catalog (note the American spelling). Every DBMS uses a database catalog(ue) or data dictionary or meta database the terms vary depending on the prevailing DBMS vendor and computing fashion to hold data about the database. (SQL normally uses the term catalog ). All the above query is actually doing is retrieving the contents of the table catalog, wherein is stored the list of table names that we want. catalog is one of the tables in the database catalog(ue) as a whole. The DESCRIBE command works by executing a more sophisticated retrieval on parts of the overall database catalog(ue). DECIDING ON NULLS The tables created so far permit data to be missing from rows in every column of every table; i.e. allow NULLs to appear there instead. In practice, this would often be unacceptable. Therefore review all the columns in all the tables, and decide which columns must always have a value in every row of the table; in other words, for these columns there can never be any exceptions, and every row must always have a value of the required type in that column. For example, in the PROJ table, it is reasonable to say that every row must have a START_DATE value, since we will not put a row in the table to represent a real-world project until we know when it will start (and hence that it definitely will start). However DEADLINE values may sometimes be missing because realistically we are not always certain when a project should finish until some considerable way through it; hence the DEADLINE column may have NULLs as well as deadline dates. Exercise: For each column in the 3 tables, decide whether NULLs are permissible or not. For each column, enter your conclusion in the right-hand page margin opposite the 6

7 column s name in the tabular design summary on page 2; then summarise your rationale for each column below : Having decided on which columns must never contain NULLs, you will need to amend the SQL table definitions to accomplish this. There are two ways to do this : 1. Drop a table (i.e. eliminate or delete it from the database) and recreate it to its new specification. 2. Alter the table appropriately. In principle, the second way is simpler, and indeed may be the only practicable way if data is stored in the table. However it uses the SQL ALTER TABLE command, which can be complex to use until you have mastered all the ramifications of specifying and creating tables. Therefore we postpone consideration of the ALTER TABLE command until later in the course, and use the first method instead; our tables contain no data yet, so this is not a problem. So get rid of all 3 tables from the database. Use the SQL command DROP TABLE table-name ; where table-name is the name of the table to be dropped or got rid of. Then re-create the 3 tables with the appropriate NON NULL columns. The syntax to be used when specifying that a column cannot contain NULLs is simply to put the phrase NOT NULL after the column s data type. Thus the formal syntax of a column specification within a CREATE TABLE statement is : 7

8 column-name <data type> [ NOT NULL ] Remember [ and ] denote an option in the syntax do not enter them. FURTHER EXERCISES Refer back to the previous exercise where you developed some relations that would form a useful database for a club or society. Select at least 2 of those relations, and : 1. Decide on a name for each relation. 2. For each attribute in each relation, decide on an attribute name and data type, and whether it must always hold a data value or whether missing data would be allowed. 3. Derive an SQL CREATE TABLE statement to create the SQL equivalent of each relation, and enter it into your database. 4. Check in the Oracle SQL catalog(ue) whether you have created the tables correctly or not. If they contain any errors, drop them and recreate them. 8

To understand the concept of candidate and primary keys and their application in table creation.

To understand the concept of candidate and primary keys and their application in table creation. CM0719: Database Modelling Seminar 5 (b): Candidate and Primary Keys Exercise Aims: To understand the concept of candidate and primary keys and their application in table creation. Outline of Activity:

More information

School of Computing, Engineering and Information Sciences University of Northumbria. Set Operations

School of Computing, Engineering and Information Sciences University of Northumbria. Set Operations Set Operations Aim: To understand how to do the equivalent of the UNION, DIFFERENCE and INTERSECT set operations in SQL. Outline of Session: Do some example SQL queries to learn to differentiate between

More information

SQL Structured Query Language Introduction

SQL Structured Query Language Introduction SQL Structured Query Language Introduction Rifat Shahriyar Dept of CSE, BUET Tables In relational database systems data are represented using tables (relations). A query issued against the database also

More information

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No.

Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. Database Management System Dr. S. Srinath Department of Computer Science & Engineering Indian Institute of Technology, Madras Lecture No. # 5 Structured Query Language Hello and greetings. In the ongoing

More information

Full file at Chapter 2: An Introduction to SQL

Full file at   Chapter 2: An Introduction to SQL Chapter 2: An Introduction to SQL TRUE/FALSE 1. Tables are called relations. ANS: T PTS: 1 REF: 26 2. Each column in a table of a relational database should have a unique name. ANS: T PTS: 1 REF: 29 3.

More information

Advanced Handle Definition

Advanced Handle Definition Tutorial for Windows and Macintosh Advanced Handle Definition 2017 Gene Codes Corporation Gene Codes Corporation 525 Avis Drive, Ann Arbor, MI 48108 USA 1.800.497.4939 (USA) +1.734.769.7249 (elsewhere)

More information

COSC 304 Introduction to Database Systems SQL DDL. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 304 Introduction to Database Systems SQL DDL. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 304 Introduction to Database Systems SQL DDL Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca SQL Overview Structured Query Language or SQL is the standard query language

More information

INTRODUCTION TO DATABASE

INTRODUCTION TO DATABASE 1 INTRODUCTION TO DATABASE DATA: Data is a collection of raw facts and figures and is represented in alphabets, digits and special characters format. It is not significant to a business. Data are atomic

More information

27 Formulas and Variables

27 Formulas and Variables 27 Formulas and Variables Formulas and variables enable you to add custom calculations within reports. One advantage of variables is they are given a name and are re-usable across the whole document, whereas

More information

An Introduction to Structured Query Language

An Introduction to Structured Query Language An Introduction to Structured Query Language Alexandra Roatiş David R. Cheriton School of Computer Science University of Waterloo CS 348 Introduction to Database Management Winter 2016 CS 348 SQL Winter

More information

Creating and Managing Tables Schedule: Timing Topic

Creating and Managing Tables Schedule: Timing Topic 9 Creating and Managing Tables Schedule: Timing Topic 30 minutes Lecture 20 minutes Practice 50 minutes Total Objectives After completing this lesson, you should be able to do the following: Describe the

More information

SQL Fundamentals. Chapter 3. Class 03: SQL Fundamentals 1

SQL Fundamentals. Chapter 3. Class 03: SQL Fundamentals 1 SQL Fundamentals Chapter 3 Class 03: SQL Fundamentals 1 Class 03: SQL Fundamentals 2 SQL SQL (Structured Query Language): A language that is used in relational databases to build and query tables. Earlier

More information

Databases IIB: DBMS-Implementation Exercise Sheet 13

Databases IIB: DBMS-Implementation Exercise Sheet 13 Prof. Dr. Stefan Brass January 27, 2017 Institut für Informatik MLU Halle-Wittenberg Databases IIB: DBMS-Implementation Exercise Sheet 13 As requested by the students, the repetition questions a) will

More information

NULLs & Outer Joins. Objectives of the Lecture :

NULLs & Outer Joins. Objectives of the Lecture : Slide 1 NULLs & Outer Joins Objectives of the Lecture : To consider the use of NULLs in SQL. To consider Outer Join Operations, and their implementation in SQL. Slide 2 Missing Values : Possible Strategies

More information

SELF TEST. List the Capabilities of SQL SELECT Statements

SELF TEST. List the Capabilities of SQL SELECT Statements 98 SELF TEST The following questions will help you measure your understanding of the material presented in this chapter. Read all the choices carefully because there might be more than one correct answer.

More information

DBLOAD Procedure Reference

DBLOAD Procedure Reference 131 CHAPTER 10 DBLOAD Procedure Reference Introduction 131 Naming Limits in the DBLOAD Procedure 131 Case Sensitivity in the DBLOAD Procedure 132 DBLOAD Procedure 132 133 PROC DBLOAD Statement Options

More information

Starting with a great calculator... Variables. Comments. Topic 5: Introduction to Programming in Matlab CSSE, UWA

Starting with a great calculator... Variables. Comments. Topic 5: Introduction to Programming in Matlab CSSE, UWA Starting with a great calculator... Topic 5: Introduction to Programming in Matlab CSSE, UWA! MATLAB is a high level language that allows you to perform calculations on numbers, or arrays of numbers, in

More information

JME Language Reference Manual

JME Language Reference Manual JME Language Reference Manual 1 Introduction JME (pronounced jay+me) is a lightweight language that allows programmers to easily perform statistic computations on tabular data as part of data analysis.

More information

DATABASE DEVELOPMENT (H4)

DATABASE DEVELOPMENT (H4) IMIS HIGHER DIPLOMA QUALIFICATIONS DATABASE DEVELOPMENT (H4) Friday 3 rd June 2016 10:00hrs 13:00hrs DURATION: 3 HOURS Candidates should answer ALL the questions in Part A and THREE of the five questions

More information

RAQUEL s Relational Operators

RAQUEL s Relational Operators Contents RAQUEL s Relational Operators Introduction 2 General Principles 2 Operator Parameters 3 Ordinary & High-Level Operators 3 Operator Valency 4 Default Tuples 5 The Relational Algebra Operators in

More information

Programming the Database

Programming the Database Programming the Database Today s Lecture 1. Stored Procedures 2. Functions BBM471 Database Management Systems Dr. Fuat Akal akal@hacettepe.edu.tr 3. Cursors 4. Triggers 5. Dynamic SQL 2 Stored Procedures

More information

Downloaded from

Downloaded from Lesson 16: Table and Integrity Constraints Integrity Constraints are the rules that a database must follow at all times. Various Integrity constraints are as follows:- 1. Not Null: It ensures that we cannot

More information

Slides by: Ms. Shree Jaswal

Slides by: Ms. Shree Jaswal Slides by: Ms. Shree Jaswal A trigger is a statement that is executed automatically by the system as a side effect of a modification to the database. To design a trigger mechanism, we must: Specify the

More information

Full file at

Full file at David Kroenke's Database Processing: Fundamentals, Design and Implementation (10 th Edition) CHAPTER TWO INTRODUCTION TO STRUCTURED QUERY LANGUAGE (SQL) True-False Questions 1. SQL stands for Standard

More information

Database Modelling. Lecture 5 Part 1: Updating Database 1/6/2015 1

Database Modelling. Lecture 5 Part 1: Updating Database 1/6/2015 1 Database Modelling Lecture 5 Part 1: Updating Database 1/6/2015 1 Learning Objectives 1. To consider how to do insertions and deletions in SQL 2. To consider amendments (updates) to a relation 3. To consider

More information

Illustrative Example of Logical Database Creation

Illustrative Example of Logical Database Creation Illustrative Example of Logical Database Creation A small RAQUEL DB is created to illustrate what is involved as regards the logical schemas of a RAQUEL DB. Create a Database or ExampleDB

More information

1) Introduction to SQL

1) Introduction to SQL 1) Introduction to SQL a) Database language enables users to: i) Create the database and relation structure; ii) Perform insertion, modification and deletion of data from the relationship; and iii) Perform

More information

C Language, Token, Keywords, Constant, variable

C Language, Token, Keywords, Constant, variable C Language, Token, Keywords, Constant, variable A language written by Brian Kernighan and Dennis Ritchie. This was to be the language that UNIX was written in to become the first "portable" language. C

More information

Why Relational Databases? Relational databases allow for the storage and analysis of large amounts of data.

Why Relational Databases? Relational databases allow for the storage and analysis of large amounts of data. DATA 301 Introduction to Data Analytics Relational Databases Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca DATA 301: Data Analytics (2) Why Relational Databases? Relational

More information

Office Wo Office W r o d r 2007 Revi i ng and R d Refifini ng a D Document

Office Wo Office W r o d r 2007 Revi i ng and R d Refifini ng a D Document Office Word 2007 Lab 2 Revising i and Refining i a Document In this lab, the student will learn more about editing documents They will learn to use many more of the formatting features included in Office

More information

PASS4TEST. IT Certification Guaranteed, The Easy Way! We offer free update service for one year

PASS4TEST. IT Certification Guaranteed, The Easy Way!  We offer free update service for one year PASS4TEST \ We offer free update service for one year Exam : 1z0-071 Title : Oracle Database 12c SQL Vendor : Oracle Version : DEMO Get Latest & Valid 1z0-071 Exam's Question and Answers 1 from Pass4test.

More information

Illustrative Example of Logical Database Creation

Illustrative Example of Logical Database Creation Illustrative Example of Logical Database Creation A small RAQUEL DB is created to illustrate what is involved as regards the logical schemas of a RAQUEL DB. Create a Database or ExampleDB

More information

Maciej Sobieraj. Lecture 1

Maciej Sobieraj. Lecture 1 Maciej Sobieraj Lecture 1 Outline 1. Introduction to computer programming 2. Advanced flow control and data aggregates Your first program First we need to define our expectations for the program. They

More information

A <column constraint> is a constraint that applies to a single column.

A <column constraint> is a constraint that applies to a single column. Lab 7 Aim: Creating Simple tables in SQL Basic Syntax for create table command is given below: CREATE TABLE ( [DEFAULT ] [], {

More information

Database Modelling. Lecture 4 (b): Database Integrity, Keys & Constraints. Akhtar Ali 10/14/2014 1

Database Modelling. Lecture 4 (b): Database Integrity, Keys & Constraints. Akhtar Ali 10/14/2014 1 Database Modelling Lecture 4 (b): Database Integrity, Keys & Constraints Akhtar Ali 10/14/2014 1 Learning Objectives 1. To consider Referential Integrity & Foreign Keys 2. To consider Referential Integrity

More information

Database Management Systems,

Database Management Systems, Database Management Systems SQL Query Language (1) 1 Topics Introduction SQL History Domain Definition Elementary Domains User-defined Domains Creating Tables Constraint Definition INSERT Query SELECT

More information

2) SQL includes a data definition language, a data manipulation language, and SQL/Persistent stored modules. Answer: TRUE Diff: 2 Page Ref: 36

2) SQL includes a data definition language, a data manipulation language, and SQL/Persistent stored modules. Answer: TRUE Diff: 2 Page Ref: 36 Database Processing, 12e (Kroenke/Auer) Chapter 2: Introduction to Structured Query Language (SQL) 1) SQL stands for Standard Query Language. Diff: 1 Page Ref: 32 2) SQL includes a data definition language,

More information

You can write a command to retrieve specified columns and all rows from a table, as illustrated

You can write a command to retrieve specified columns and all rows from a table, as illustrated CHAPTER 4 S I N G L E - TA BL E QUERIES LEARNING OBJECTIVES Objectives Retrieve data from a database using SQL commands Use simple and compound conditions in queries Use the BETWEEN, LIKE, and IN operators

More information

chapter 2 G ETTING I NFORMATION FROM A TABLE

chapter 2 G ETTING I NFORMATION FROM A TABLE chapter 2 Chapter G ETTING I NFORMATION FROM A TABLE This chapter explains the basic technique for getting the information you want from a table when you do not want to make any changes to the data and

More information

An Introduction to Structured Query Language

An Introduction to Structured Query Language An Introduction to Structured Query Language Grant Weddell David R. Cheriton School of Computer Science University of Waterloo CS 348 Introduction to Database Management Spring 2012 CS 348 (Intro to DB

More information

Database implementation Further SQL

Database implementation Further SQL IRU SEMESTER 2 January 2010 Semester 1 Session 2 Database implementation Further SQL Objectives To be able to use more advanced SQL statements, including Renaming columns Order by clause Aggregate functions

More information

An Introduction to Structured Query Language

An Introduction to Structured Query Language An Introduction to Structured Query Language Grant Weddell David R. Cheriton School of Computer Science University of Waterloo CS 348 Introduction to Database Management Spring 2012 CS 348 (Intro to DB

More information

Programming Lecture 3

Programming Lecture 3 Programming Lecture 3 Expressions (Chapter 3) Primitive types Aside: Context Free Grammars Constants, variables Identifiers Variable declarations Arithmetic expressions Operator precedence Assignment statements

More information

Test Bank for Database Processing Fundamentals Design and Implementation 13th Edition by Kroenke

Test Bank for Database Processing Fundamentals Design and Implementation 13th Edition by Kroenke Test Bank for Database Processing Fundamentals Design and Implementation 13th Edition by Kroenke Link full download: https://testbankservice.com/download/test-bank-fordatabase-processing-fundamentals-design-and-implementation-13th-edition-bykroenke

More information

A Simple Guide to Using SPSS (Statistical Package for the. Introduction. Steps for Analyzing Data. Social Sciences) for Windows

A Simple Guide to Using SPSS (Statistical Package for the. Introduction. Steps for Analyzing Data. Social Sciences) for Windows A Simple Guide to Using SPSS (Statistical Package for the Social Sciences) for Windows Introduction ٢ Steps for Analyzing Data Enter the data Select the procedure and options Select the variables Run the

More information

SQL: Data De ni on. B0B36DBS, BD6B36DBS: Database Systems. h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 3

SQL: Data De ni on. B0B36DBS, BD6B36DBS: Database Systems. h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 3 B0B36DBS, BD6B36DBS: Database Systems h p://www.ksi.m.cuni.cz/~svoboda/courses/172-b0b36dbs/ Lecture 3 SQL: Data De ni on Mar n Svoboda mar n.svoboda@fel.cvut.cz 13. 3. 2018 Czech Technical University

More information

An Introduction to Structured Query Language

An Introduction to Structured Query Language An Introduction to Structured Query Language Grant Weddell Cheriton School of Computer Science University of Waterloo CS 348 Introduction to Database Management Winter 2017 CS 348 (Intro to DB Mgmt) SQL

More information

Information Systems Engineering. SQL Structured Query Language DDL Data Definition (sub)language

Information Systems Engineering. SQL Structured Query Language DDL Data Definition (sub)language Information Systems Engineering SQL Structured Query Language DDL Data Definition (sub)language 1 SQL Standard Language for the Definition, Querying and Manipulation of Relational Databases on DBMSs Its

More information

Illustrative Example of Physical Schema Usage

Illustrative Example of Physical Schema Usage Example of Physical Usage 14 th February 2014 (30 th March 2001) Illustrative Example of Physical Usage The example assumes that a small RAQUEL DB and its relational model schemas have already been created.

More information

TUTORIAL FOR IMPORTING OTTAWA FIRE HYDRANT PARKING VIOLATION DATA INTO MYSQL

TUTORIAL FOR IMPORTING OTTAWA FIRE HYDRANT PARKING VIOLATION DATA INTO MYSQL TUTORIAL FOR IMPORTING OTTAWA FIRE HYDRANT PARKING VIOLATION DATA INTO MYSQL We have spent the first part of the course learning Excel: importing files, cleaning, sorting, filtering, pivot tables and exporting

More information

An Introduction to Structured Query Language

An Introduction to Structured Query Language An Introduction to Structured Query Language Grant Weddell Cheriton School of Computer Science University of Waterloo CS 348 Introduction to Database Management Spring 2016 CS 348 (Intro to DB Mgmt) SQL

More information

Data about data is database Select correct option: True False Partially True None of the Above

Data about data is database Select correct option: True False Partially True None of the Above Within a table, each primary key value. is a minimal super key is always the first field in each table must be numeric must be unique Foreign Key is A field in a table that matches a key field in another

More information

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 05 I/O statements Printf, Scanf Simple

More information

Variables and Constants

Variables and Constants 87 Chapter 5 Variables and Constants 5.1 Storing Information in the Computer 5.2 Declaring Variables 5.3 Inputting Character Strings 5.4 Mistakes in Programs 5.5 Inputting Numbers 5.6 Inputting Real Numbers

More information

WHAT IS A DATABASE? There are at least six commonly known database types: flat, hierarchical, network, relational, dimensional, and object.

WHAT IS A DATABASE? There are at least six commonly known database types: flat, hierarchical, network, relational, dimensional, and object. 1 WHAT IS A DATABASE? A database is any organized collection of data that fulfills some purpose. As weather researchers, you will often have to access and evaluate large amounts of weather data, and this

More information

Basant Group of Institution

Basant Group of Institution Basant Group of Institution Visual Basic 6.0 Objective Question Q.1 In the relational modes, cardinality is termed as: (A) Number of tuples. (B) Number of attributes. (C) Number of tables. (D) Number of

More information

Mahathma Gandhi University

Mahathma Gandhi University Mahathma Gandhi University BSc Computer science III Semester BCS 303 OBJECTIVE TYPE QUESTIONS Choose the correct or best alternative in the following: Q.1 In the relational modes, cardinality is termed

More information

Arrays. Defining arrays, declaration and initialization of arrays. Designed by Parul Khurana, LIECA.

Arrays. Defining arrays, declaration and initialization of arrays. Designed by Parul Khurana, LIECA. Arrays Defining arrays, declaration and initialization of arrays Introduction Many applications require the processing of multiple data items that have common characteristics (e.g., a set of numerical

More information

SQL. Char (30) can store ram, ramji007 or 80- b

SQL. Char (30) can store ram, ramji007 or 80- b SQL In Relational database Model all the information is stored on Tables, these tables are divided into rows and columns. A collection on related tables are called DATABASE. A named table in a database

More information

GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement

GIFT Department of Computing Science Data Selection and Filtering using the SELECT Statement GIFT Department of Computing Science [Spring 2013] CS-217: Database Systems Lab-2 Manual Data Selection and Filtering using the SELECT Statement V1.0 4/12/2016 Introduction to Lab-2 This lab reinforces

More information

T-SQL Training: T-SQL for SQL Server for Developers

T-SQL Training: T-SQL for SQL Server for Developers Duration: 3 days T-SQL Training Overview T-SQL for SQL Server for Developers training teaches developers all the Transact-SQL skills they need to develop queries and views, and manipulate data in a SQL

More information

Test Bank for A Guide to SQL 9th Edition by Pratt

Test Bank for A Guide to SQL 9th Edition by Pratt Test Bank for A Guide to SQL 9th Edition by Pratt Link full download: https://testbankservice.com/download/test-bank-for-a-guideto-sql-9th-edition-by-pratt Chapter 2: Database Design Fundamentals True

More information

1 SQL Structured Query Language

1 SQL Structured Query Language 1 SQL Structured Query Language 1.1 Tables In relational database systems (DBS) data are represented using tables (relations). A query issued against the DBS also results in a table. A table has the following

More information

Getting Information from a Table

Getting Information from a Table ch02.fm Page 45 Wednesday, April 14, 1999 2:44 PM Chapter 2 Getting Information from a Table This chapter explains the basic technique of getting the information you want from a table when you do not want

More information

Sample Question Paper

Sample Question Paper Sample Question Paper Marks : 70 Time:3 Hour Q.1) Attempt any FIVE of the following. a) List any four applications of DBMS. b) State the four database users. c) Define normalization. Enlist its type. d)

More information

set in Options). Returns the cursor to its position prior to the Correct command.

set in Options). Returns the cursor to its position prior to the Correct command. Dragon Commands Summary Dragon Productivity Commands Relative to Dragon for Windows v14 or higher Dictation success with Dragon depends on just a few commands that provide about 95% of the functionality

More information

SPEECH RECOGNITION COMMON COMMANDS

SPEECH RECOGNITION COMMON COMMANDS SPEECH RECOGNITION COMMON COMMANDS FREQUENTLY USED COMMANDS The table below shows some of the most commonly used commands in Windows Speech Recognition. The words in italics indicate that many different

More information

1.8 Database and data Data Definition Language (DDL) and Data Manipulation Language (DML)

1.8 Database and data Data Definition Language (DDL) and Data Manipulation Language (DML) 1.8.3 Data Definition Language (DDL) and Data Manipulation Language (DML) Data Definition Language (DDL) DDL, which is usually part of a DBMS, is used to define and manage all attributes and properties

More information

Creating the Data Layer

Creating the Data Layer Creating the Data Layer When interacting with any system it is always useful if it remembers all the settings and changes between visits. For example, Facebook has the details of your login and any conversations

More information

Python allows variables to hold string values, just like any other type (Boolean, int, float). So, the following assignment statements are valid:

Python allows variables to hold string values, just like any other type (Boolean, int, float). So, the following assignment statements are valid: 1 STRINGS Objectives: How text data is internally represented as a string Accessing individual characters by a positive or negative index String slices Operations on strings: concatenation, comparison,

More information

Full file at

Full file at ch2 True/False Indicate whether the statement is true or false. 1. The SQL command to create a database table is an example of DML. 2. A user schema contains all database objects created by a user. 3.

More information

Based on the following Table(s), Write down the queries as indicated: 1. Write an SQL query to insert a new row in table Dept with values: 4, Prog, MO

Based on the following Table(s), Write down the queries as indicated: 1. Write an SQL query to insert a new row in table Dept with values: 4, Prog, MO Based on the following Table(s), Write down the queries as indicated: 1. Write an SQL query to insert a new row in table Dept with values: 4, Prog, MO INSERT INTO DEPT VALUES(4, 'Prog','MO'); The result

More information

Databases. Relational Model, Algebra and operations. How do we model and manipulate complex data structures inside a computer system? Until

Databases. Relational Model, Algebra and operations. How do we model and manipulate complex data structures inside a computer system? Until Databases Relational Model, Algebra and operations How do we model and manipulate complex data structures inside a computer system? Until 1970.. Many different views or ways of doing this Could use tree

More information

CS2 Current Technologies Note 1 CS2Bh

CS2 Current Technologies Note 1 CS2Bh CS2 Current Technologies Note 1 Relational Database Systems Introduction When we wish to extract information from a database, we communicate with the Database Management System (DBMS) using a query language

More information

RDBMS File Access Guide

RDBMS File Access Guide RDBMS File Access Guide Release 8.1.3 November 2013 IKAN Solutions N.V. Schaliënhoevedreef 20A B-2800 Mechelen BELGIUM Copyright 2013, IKAN Solutions N.V. No part of this document may be reproduced or

More information

Chapter 17: Table & Integrity Contraints. Informatics Practices Class XII. By- Rajesh Kumar Mishra. KV No.1, AFS, Suratgarh

Chapter 17: Table & Integrity Contraints. Informatics Practices Class XII. By- Rajesh Kumar Mishra. KV No.1, AFS, Suratgarh Chapter 17: Table & Integrity Contraints Informatics Practices Class XII By- Rajesh Kumar Mishra PGT (Comp.Sc.) KV No.1, AFS, Suratgarh e-mail : rkmalld@gmail.com Integrity Constraints One of the major

More information

Relational Model History. COSC 416 NoSQL Databases. Relational Model (Review) Relation Example. Relational Model Definitions. Relational Integrity

Relational Model History. COSC 416 NoSQL Databases. Relational Model (Review) Relation Example. Relational Model Definitions. Relational Integrity COSC 416 NoSQL Databases Relational Model (Review) Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Relational Model History The relational model was proposed by E. F. Codd

More information

The Relational Model

The Relational Model The Relational Model Grant Weddell David R. Cheriton School of Computer Science University of Waterloo CS 348 Introduction to Database Management Spring 2012 CS 348 (Intro to DB Mgmt) Relational Model

More information

Privacy and Security in Online Social Networks Department of Computer Science and Engineering Indian Institute of Technology, Madras

Privacy and Security in Online Social Networks Department of Computer Science and Engineering Indian Institute of Technology, Madras Privacy and Security in Online Social Networks Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 08 Tutorial 2, Part 2, Facebook API (Refer Slide Time: 00:12)

More information

Database Management Systems,

Database Management Systems, Database Management Systems Database Design (2) 1 Topics Data Base Design Logical Design (Review) Physical Design Entity Relationship (ER) Model to Relational Model Entity Relationship Attributes Normalization

More information

)454 : 4(% #(!2!#4%2 3%4!.$ "!3)# %,%-%.43 -!.-!#().%,!.'5!'% )454 Recommendation : INTERNATIONAL TELECOMMUNICATION UNION

)454 : 4(% #(!2!#4%2 3%4!.$ !3)# %,%-%.43 -!.-!#().%,!.'5!'% )454 Recommendation : INTERNATIONAL TELECOMMUNICATION UNION INTERNATIONAL TELECOMMUNICATION UNION )454 : TELECOMMUNICATION STANDARDIZATION SECTOR OF ITU -!.-!#().%,!.'5!'% 4(% #(!2!#4%2 3%4!.$ "!3)# %,%-%.43 )454 Recommendation : (Extract from the "LUE "OOK) NOTES

More information

Text Processing (Business Professional)

Text Processing (Business Professional) Unit Title: Mailmerge OCR unit number: 06994 Level: 2 Credit value: 5 Guided learning hours: 50 Unit reference number: F/505/7091 Unit aim Text Processing (Business Professional) This unit aims to equip

More information

CITS2401 Computer Analysis & Visualisation

CITS2401 Computer Analysis & Visualisation FACULTY OF ENGINEERING, COMPUTING AND MATHEMATICS CITS2401 Computer Analysis & Visualisation SCHOOL OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING Topic 3 Introduction to Matlab Material from MATLAB for

More information

1 SQL Structured Query Language

1 SQL Structured Query Language 1 SQL Structured Query Language 1.1 Tables In relational database systems (DBS) data are represented using tables (relations). A query issued against the DBS also results in a table. A table has the following

More information

TUTORIAL FOR IMPORTING OTTAWA FIRE HYDRANT PARKING VIOLATION DATA INTO MYSQL

TUTORIAL FOR IMPORTING OTTAWA FIRE HYDRANT PARKING VIOLATION DATA INTO MYSQL TUTORIAL FOR IMPORTING OTTAWA FIRE HYDRANT PARKING VIOLATION DATA INTO MYSQL We have spent the first part of the course learning Excel: importing files, cleaning, sorting, filtering, pivot tables and exporting

More information

BMC Remedy AR System change ID utility

BMC Remedy AR System change ID utility BMC Remedy AR System change ID utility The BMC Remedy AR System change ID utility enables you to change the IDs of certain objects. This document explains the purpose and usage of the utility. The BMC

More information

SQL STRUCTURED QUERY LANGUAGE

SQL STRUCTURED QUERY LANGUAGE STRUCTURED QUERY LANGUAGE SQL Structured Query Language 4.1 Introduction Originally, SQL was called SEQUEL (for Structured English QUery Language) and implemented at IBM Research as the interface for an

More information

Text Processing (Business Professional)

Text Processing (Business Professional) Text Processing (Business Professional) Unit Title: Business Presentations OCR unit number: 06968 Level: 1 Credit value: 4 Guided learning hours: 40 Unit reference number: D/505/7079 Unit aim This unit

More information

Text Processing (Business Professional)

Text Processing (Business Professional) Unit Title: Mailmerge OCR unit number: 06971 Level: 1 Credit value: 4 Guided learning hours: 40 Unit reference number: R/505/7080 Unit aim Text Processing (Business Professional) This unit aims to equip

More information

Formatting the spreadsheet data

Formatting the spreadsheet data 2 Formatting the spreadsheet data this chapter covers... In this chapter we describe ways of formatting data within a spreadsheet using different text fonts and styles. We also explain different ways of

More information

Babu Madhav Institute of Information Technology 2015

Babu Madhav Institute of Information Technology 2015 Paper No.:060010102 Subject: Database Management Systems (Practical) Program: 5 Years Integrated M.Sc.(IT) Semester: 01 Practical No: 1 Enrolment No: Practical Problem Create following tables: CLIENT_MASTER

More information

TEXT PROCESSING (BUSINESS PROFESSIONAL) Mailmerge Level 1 (06971) Credits: 4. Learning Outcomes The learner will 1 Be able to use a word processor

TEXT PROCESSING (BUSINESS PROFESSIONAL) Mailmerge Level 1 (06971) Credits: 4. Learning Outcomes The learner will 1 Be able to use a word processor TEXT PROCESSING (BUSINESS PROFESSIONAL) Mailmerge Level: 1 06971 Credits: 4 Learning Time: 40 hours Learning Outcomes The learner will 1 Be able to use a word processor 2 Be able to key in text from handwritten

More information

EECS-3421a: Test #1 Design

EECS-3421a: Test #1 Design 2016 October 12 EECS-3421a: Test #1 1 of 14 EECS-3421a: Test #1 Design Electrical Engineering & Computer Science Lassonde School of Engineering York University Family Name: Given Name: Student#: EECS Account:

More information

CSCU9Q5 Introduction to MySQL. Data Definition & Manipulation (Over ~two Lectures)

CSCU9Q5 Introduction to MySQL. Data Definition & Manipulation (Over ~two Lectures) CSCU9Q5 Introduction to MySQL Data Definition & Manipulation (Over ~two Lectures) 1 Contents Introduction to MySQL Create a table Specify keys and relations Empty and Drop tables 2 Introduction SQL is

More information

Text Processing (Business Professional) within the Business Skills suite

Text Processing (Business Professional) within the Business Skills suite Text Processing (Business Professional) within the Business Skills suite Unit Title: Mailmerge OCR unit number: 06971 Unit reference number: T/501/4173 Level: 1 Credit value: 4 Guided learning hours: 40

More information

COMP 110 Project 1 Programming Project Warm-Up Exercise

COMP 110 Project 1 Programming Project Warm-Up Exercise COMP 110 Project 1 Programming Project Warm-Up Exercise Creating Java Source Files Over the semester, several text editors will be suggested for students to try out. Initially, I suggest you use JGrasp,

More information

A Flat file database. Problems with a flat file database (data redundancy)

A Flat file database. Problems with a flat file database (data redundancy) Data capture Before you can create a database, you need to collect data. This is known as data capture. One of the most common ways is to use and optical mark reader (OMR). An OMR sensor is used for marking

More information

All copyrights reserved - KV NAD, Aluva. Dinesh Kumar Ram PGT(CS) KV NAD Aluva

All copyrights reserved - KV NAD, Aluva. Dinesh Kumar Ram PGT(CS) KV NAD Aluva All copyrights reserved - KV NAD, Aluva Dinesh Kumar Ram PGT(CS) KV NAD Aluva Overview Looping Introduction While loops Syntax Examples Points to Observe Infinite Loops Examples using while loops do..

More information

What is SQL? Toolkit for this guide. Learning SQL Using phpmyadmin

What is SQL? Toolkit for this guide. Learning SQL Using phpmyadmin http://www.php-editors.com/articles/sql_phpmyadmin.php 1 of 8 Members Login User Name: Article: Learning SQL using phpmyadmin Password: Remember Me? register now! Main Menu PHP Tools PHP Help Request PHP

More information

Lab # 2. Data Definition Language (DDL) Eng. Alaa O Shama

Lab # 2. Data Definition Language (DDL) Eng. Alaa O Shama The Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4113: Database Lab Lab # 2 Data Definition Language (DDL) Eng. Alaa O Shama October, 2015 Objective To be familiar

More information