Question

Select all rows from the new table you''ve just created (there should only be the two...

Select all rows from the new table you''ve just created (there should only be the two rows you just inserted!).
Order the output by your table''s primary key; format all columns using CAST, CONVERT and/or STR.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Let us create a Table called "SampleTable"

CREATE TABLE SampleTable
(
ID INT NOT NULL PRIMARY KEY,
FirstName VARCHAR(30) NOT NULL,
LastName VARCHAR(30) NOT NULL
);

Now we need to insert data into this table.
Sql 1:-

INSERT INTO SampleTable VALUES (1, 'Stephen', 'Jiang');

Sql 2 :-

INSERT INTO SampleTable (ID, FirstName, LastName) VALUES (2, 'Avinash', 'kotina');

data in the table :-
-------------------
1, 'Stephen', 'Jiang'
2, 'Avinash', 'kotina'


Select all rows from the new table you''ve just created (there should only be the two rows you just inserted!).
Order the output by your table''s primary key; format all columns using CAST, CONVERT and/or STR.

select * from SampleTable Orderby ID;

data after the above sql executed will be :-
-------------------
1, 'Stephen', 'Jiang'
2, 'Avinash', 'kotina'

SELECT FIRSTNAME, CAST(ID AS Float) Float_ID FROM SampleTable;

Now ID filed will be casted/convereted to Float

data after the above sql executed will be :-
-------------------
1.0, 'Stephen', 'Jiang'
2.0, 'Avinash', 'kotina'

Add a comment
Know the answer?
Add Answer to:
Select all rows from the new table you''ve just created (there should only be the two...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You are designing a table for employee data of a company. You have a requirement to...

    You are designing a table for employee data of a company. You have a requirement to identify if an employee is a United States citizen or not. You have designed a table called EMPLOYEE to store information related to each employee and you have a column called US CITIZEN INDICATOR to store if an employee is a US citizen or not. You only want to store values "Y" or "N" in this column. From the following options, what is the...

  • 3. Write a script that adds rows to the database that you created in exercise 2....

    3. Write a script that adds rows to the database that you created in exercise 2. Add two rows to the Users and Products tables. Add three rows to the Downloads table: one row for user 1 and product 2; one row for user 2 and product 1; and one row for user 2 and product 2. Use the SYSDATE function to insert the current date into the download_date column. Use the sequences created in the previous exercise to get...

  • SQL Question 2 Using your table from question 1: Create a minimum of 4 INSERTS. On...

    SQL Question 2 Using your table from question 1: Create a minimum of 4 INSERTS. On one of your INSERTs, do not specify all of your columns. In other words, if you have 5 columns in your table, only mention 4 or less columns in one of your INSERTs. Be sure to write a comment above the INSERT with less columns and explain what is missing in a full English sentence. You should write a simple SELECT after your INSERTs...

  • SQL Homework exercises: 1. Write INSERT statements that add two rows to the Members table for...

    SQL Homework exercises: 1. Write INSERT statements that add two rows to the Members table for member IDs 1 and 2, two rows to the Groups table for group IDs 1 and 2, and three rows to the Group_Membership table: one row for member 1 and group 2; one for member 2 and group 1; and one for member 2 and group 2. Then, write a SELECT statement that joins the three tables and retrieves the group name, member last...

  • QUESTIONS Q01: Use the comment feature of SQL to print your full name, AUID and username in three separate lines at the top of the script file. From this point onwards, you should use the comment fea...

    QUESTIONS Q01: Use the comment feature of SQL to print your full name, AUID and username in three separate lines at the top of the script file. From this point onwards, you should use the comment feature to separate your answers for each question. (0.2 mark) Q02: Write a SQL statement to retrieve all the rows from the Product table. All the columns should be renamed with proper spacing using the alias feature. For example, the UnitPrice column should be...

  • A(n) __________________ is a logical connection between rows in two tables where data in one table...

    A(n) __________________ is a logical connection between rows in two tables where data in one table references data in another table. The SQL ________________ statement removes a table from a database. The relational algebra "restrict" operator selects only the rows from the input table(s)  that satisfy a condition expressed in the _________________ clause. The SQL/PL ______________ command is used to re-direct the output of a script file to a text file. The ________________________ join creates a result set that includes the...

  • this is sql developer question I just need the format of how to answer question! Create...

    this is sql developer question I just need the format of how to answer question! Create sequences (2) that can be used to number the member ID and group ID values starting with 3 (since you already have 1 and 2). Write an INSERT statement that adds another row to the Groups table, make up a group name. Use the NEXTVAL pseudo column to get the value for the next group ID from the sequence that you created in #5....

  • 4a) Create a new table that has one column called GoodID and 2 or 3 other...

    4a) Create a new table that has one column called GoodID and 2 or 3 other columns with whatever names and data types you want. But set up a Primary Key Constraint on the GoodID column. Use DESCRIBE to show the column definitions for your table, and paste that in here: 4b) INSERT one row into the table with GoodID equal to 13 and whatever other data (column values) you want. 4c) INSERT another row into the table with GoodID...

  • Study the VIGENÈRE CIPHER and implemented it with c++ 1.In your program, you should have two...

    Study the VIGENÈRE CIPHER and implemented it with c++ 1.In your program, you should have two functions: encryption and decryption. 2. Use any key you like. (Don't use deceptive in the slides) 3. choose a sentence or a paragraph you like as the plaintext. I have the code I just need the implementation in a different way // C++ code to implement Vigenere Cipher #include<bits/stdc++.h> using namespace std; // This function generates the key in // a cyclic manner until...

  • Write a method named printGrid that accepts two integer parameters rows and cols. The output is...

    Write a method named printGrid that accepts two integer parameters rows and cols. The output is a comma-separated grid of numbers where the first parameter (rows) represents the number of rows of the grid and the second parameter (cols) represents the number of columns. The numbers count up from 1 to (rows x cols). The output are displayed in column-major order, meaning that the numbers shown increase sequentially down each column and wrap to the top of the next column...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT