Write an SQL statement to create a table called BUYER with the following columns. Make sure to choose the appropriate data type for each column with the data given: • BUYER_ID, exactly 4 characters and will serve as the Primary Key • BUYER_Name, up to 25 characters • BUYER_Age, number data type field with no decimals • BUYER_ADDRESS, up to 30 characters • SALARY, number data type field with two decimals
Added by Anna B.
Close
Step 1
CREATE TABLE BUYER ( Show more…
Show all steps
Your feedback will help us improve your experience
Michael Feffer and 54 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
You are given two tables: Employees and Employee_pan. The column 'id' denotes the ID of the employee in both tables. Print the UIN and NAME of all employees who are younger than 25. Table: EMPLOYEES Field | Type ID (PK) | int Name | char(20) Age | int Address | char(25) Salary | decimal(18,2) Table: EMPLOYEE_PAN Field | Type ID (PK) | int UIN | int
Michael F.
You are given a table flats with the following structure: create table flats ( id integer primary key, city varchar(40) not null, price integer not null ); Each row of table flats represents a flat located in city available for sale for a given price. Write an SQL query that, for each city finds the three cheapest flats located in that city. In case of a tie, the query may return any three flats with the cheapest prices. The result table should contain three columns: id, city and price and should be sorted by id column. If the city has less than three flats for sale, the result table should contain all of them. Please use an OVER clause to simplify your solution. Example: 1. Given: +----+-----------+--------+ | id | city | price | +----+-----------+--------+ | 25 | London | 200000 | | 5 | Cairo | 90000 | | 7 | London | 200000 | | 18 | Warsaw | 150000 | | 2 | London | 178000 | | 3 | Cairo | 300000 | | 21 | London | 500000 | | 9 | London | 200000 | +----+-----------+--------+ one of the possible outputs is: +----+-----------+--------+ | id | city | price | +----+-----------+--------+ | 2 | London | 178000 | | 3 | Cairo | 300000 | | 5 | Cairo | 90000 | | 7 | London | 200000 | | 9 | London | 200000 | | 18 | Warsaw | 150000 | +----+-----------+--------+ There are only two flats available in Warsaw and one in Cairo, so they are all selected. The cheapest flat in London has ID 2, then there are three flats with the same price (with IDs: 7, 9, 25). Any two of them may be selected. Assume that: - the flats table has at most 100 rows; - price column can only contain integers from 1000 to 10000000 inclusive.
Supreeta N.
1. Create another version of the Students table called Student2. The only difference is that StudentID is of the datatype varchar(5) and the column can only have codes which are like AB123. The first 2 characters have to be alphabets and the next 3 are integers. 2. Create another version of the Grades table called Grades2. The grade column can only have values between 0 and 4.0. 3. Create a table called Classes with the following columns: - ClassName (Character Primary key) - Date Class Offered (Character 50) - ClassID (Int Primary Key) - Instructor ID (Date Primary Key) - Section (Character1)
Akash M.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD