https://github.com/alpha74/java_sql_and_jdbc
A Java project to mimic variations of insert and select commands of SQL, and modify the database.
https://github.com/alpha74/java_sql_and_jdbc
java jdbc mysql sql
Last synced: 10 months ago
JSON representation
A Java project to mimic variations of insert and select commands of SQL, and modify the database.
- Host: GitHub
- URL: https://github.com/alpha74/java_sql_and_jdbc
- Owner: alpha74
- Created: 2019-09-01T13:13:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-09-04T16:45:02.000Z (over 6 years ago)
- Last Synced: 2025-01-16T04:41:27.390Z (12 months ago)
- Topics: java, jdbc, mysql, sql
- Language: PLpgSQL
- Homepage:
- Size: 345 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SQL Commands in Java
- Mimic the `INSERT` and `SELECT` clauses.
- Data is inserted/fetched from Java application commandline.
- Read the full **Problem Statement** below.
### Requirements:
- MySQL database
- JDBC connection
- JDK package
---
### Problem Statement:
- Write a java program which takes any of the following commands as command line argument (not as input), and executes them using JDBC:
1. `insert into relationname value1 value2 value3 ...`
- Inserts a tuple into the specified relation with the specified values; make sure you use a prepared statement.
- Test it with input containing single quotes.
- You can assume that all values are strings for simplicity
2. `select from relationname`
- Prints all tuples from the specified relation.
- You should assume that relationname is one of "instructor", "student" or "takes", and not use database metadata features to print the tuples.
3. `select from relationname where "condition"`
- Executes a query with the specified condition.
- Note the use of double quotes so that the condition comes as a single command line parameter.
- Again assume relationname is one of those from the previous feature. So this is really a small addition to the code for the previous feature, do NOT make a separate copy of the code.
4. `select from relationname1 relationname2`
- Displays result of natural join of the two relations.
- This time, use the resultset metadata feature to display all values from the query result.
- Display column names.