2.2 Basic Database Functions Your database server only needs to support one database. Therefore, all func- tions will be applied to the server's default database. All SQL statements need to be terminated by a semicolon (';'). Thus, your server needs to parse the user input until it encounters a semicolon. Create Table It has to be possible to create new database tables using SQL. Your create statement needs to support the specification of the column names and their respective data types. The only data types you need to support are VARCHAR (n), a variable length character string of at most n characters, and INT, a 32-bit integer value. An example create table statement is: CREATE TABLE Students ( id INT, first_name VARCHAR (7), last_name VARCHAR(8) ); This statement should create a new table called “Students" with the columns “id", "first_name", and “last_name". The “id" column should be an integer column, while the "first_name" and the “last_name" column should be character strings of at most 7 and 8 characters respectively. List Tables and Schemas In general, it is practical to be able to see which tables already exist and which columns and data types are defined. Since there is no standard way to do this in SQL, you should implement two additional commands called .tables and .schema. While .tables should list all defined tables, .schema should show the columns and column data types for the specified table. Note that these commands are not terminated with a semicolon. An example for listing tables would be: $> .tables Students Listing the schema for the table “Students" could look as follows: $> .schema Students id first_name VARCHAR(5) last_name INT VARCHAR (8)
2.2 Basic Database Functions Your database server only needs to support one database. Therefore, all func- tions will be applied to the server's default database. All SQL statements need to be terminated by a semicolon (';'). Thus, your server needs to parse the user input until it encounters a semicolon. Create Table It has to be possible to create new database tables using SQL. Your create statement needs to support the specification of the column names and their respective data types. The only data types you need to support are VARCHAR (n), a variable length character string of at most n characters, and INT, a 32-bit integer value. An example create table statement is: CREATE TABLE Students ( id INT, first_name VARCHAR (7), last_name VARCHAR(8) ); This statement should create a new table called “Students" with the columns “id", "first_name", and “last_name". The “id" column should be an integer column, while the "first_name" and the “last_name" column should be character strings of at most 7 and 8 characters respectively. List Tables and Schemas In general, it is practical to be able to see which tables already exist and which columns and data types are defined. Since there is no standard way to do this in SQL, you should implement two additional commands called .tables and .schema. While .tables should list all defined tables, .schema should show the columns and column data types for the specified table. Note that these commands are not terminated with a semicolon. An example for listing tables would be: $> .tables Students Listing the schema for the table “Students" could look as follows: $> .schema Students id first_name VARCHAR(5) last_name INT VARCHAR (8)
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
I JUST WANT TO KNOW HOW A .TABLES AND .SCHEMA COMMAND WILL BE CREATED.
When the databse server is running andi need to apply these command in order to see the details.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education