ujjwalguptaofficial / sqlweb

SqlWeb is an extension of JsStore which allows to use sql query for performing database operation in IndexedDB.
https://github.com/ujjwalguptaofficial/sqlweb/wiki
MIT License
54 stars 15 forks source link

column names alias #5

Closed mburahmeh closed 5 years ago

mburahmeh commented 5 years ago

Hi

You can use "as" for aliasing a column name just like sql. Here is an example -

select Customers.CustomerName as name, Customers.ContactName as cName, Customers.CustomerID as cId from Orders join Customers 
on 
Orders.CustomerID=Customers.CustomerID

Originally posted by @ujjwalguptaofficial in https://github.com/ujjwalguptaofficial/sqlweb/issues/3#issuecomment-525553958

aliasing is working fine but the returned query still contains all columns plus the alias column , what i need is how to select aliasing columns only without other columns

ujjwalguptaofficial commented 5 years ago

IndexedDb is NoSQL database means your whole data is stored as object & thus retrieved as object. JsStore dont filter columns because it will be extra computation.

We recommend to use what you need from the results & don't care about extra data. The data is stored locally, so its not much of issue unlike server side database.

e.g - if result is something like that -

var result = [{
    id: 1,
    name: 'ujjwal gupta',
    address: 'india',
    gender: 'male'
}]

From this result - i need only name & gender. So i will use only name & gender don't care about extra data.