4GL vs.
SQL
4GL is programming language to fetch the data
from the Progress database, it do support the sql query but it will be much faster if you use 4GL and some
complicated sql query which progress compiler will not understand so it is
recommended to use the 4GL over SQL.
When it come to programming language it do have
its own syntax, prototype, data types etc, 4GL also has its own, where it seems
bit difficult to the beginners if you know English grammar I assure you will
become good 4GL programmerJ.
First thing we learn in SQL is the customer
table field extraction as we get example in the all academic text book,
select *
from customer;
4GL corresponding for the same will be
for each
customer:
display
customer.
Simpler than ever. which was the t-shirt quotes
for 2 decades. above program will give the all the fields and records of
customer table, it will display the record page by page, once it reaches the
bottom of screen it’ll pause the display and shows message as “press space bar
to continue” once you hit space key it will display next set of record till it
hit the end of records, in the time of execution if you do not want to continue
you can hit esc and press spacebar.
Below are the few comparison 4GL and SQL
|
Select * from customer;
|
for each customer:
display customer.
|
|
select cust_num, city from customer;
|
for each customer:
display cust_num city.
|
|
select * from customer
where name=’Darshan’;
|
for each customer where name = ‘Darshan’:
display customer.
|
|
select * from customer
where name=’Darshan’
order by name;
|
for each customer where name = ‘Darshan’ by
name:
display customer.
|
|
select * from customer
where name not null
order by name;
|
for each customer where name <> ? by
name:
display customer.
|
|
select customer.custnum, name, city, ordernum, orderdate,
shipdate from customer, order
where state = “Karnataka” and customer.custnum = order.custnum;
|
for each customer where state = 'Karnataka'
by city:
display custnum name city.
for
each order of customer:
display
ordernum orderdate shipdate.
end.
end.
|
No comments:
Post a Comment