Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 840589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:38:56+00:00 2026-05-15T05:38:56+00:00

How can I translate this 2 queries in postgresql ? : CREATE TABLE `example`

  • 0

How can I translate this 2 queries in postgresql ? :

CREATE TABLE  `example` ( 
  `id` int(10) unsigned NOT NULL auto_increment,    
  `from` varchar(255) NOT NULL default '0',    
  `message` text NOT NULL,    
  `lastactivity` timestamp NULL default '0000-00-00 00:00:00',    
  `read` int(10) unsigned NOT NULL,    
  PRIMARY KEY  (`id`),    
  KEY `from` (`from`)    
) DEFAULT CHARSET=utf8;

Query:

SELECT *
FROM table_1
LEFT OUTER JOIN table_2 ON ( table_1.id = table_2.id ) 
WHERE (table_1.lastactivity > NOW()-100);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T05:38:57+00:00Added an answer on May 15, 2026 at 5:38 am

    Use:

       SELECT *
         FROM table_1 t1
    LEFT JOIN table_2 t2 ON t2.id = t1.id
        WHERE t1.lastactivity > CURRENT_TIMESTAMP - INTERVAL '100 days'
    

    CURRENT_TIMESTAMP is ANSI standard, and works on Oracle, MySQL, Postgres, SQL Server…

    Here’s the CREATE table statement converted:

    CREATE TABLE example (
      id INTEGER PRIMARY KEY, 
      "from" VARCHAR(255) NOT NULL DEFAULT '0',
      message text NOT NULL,
      lastactivity timestamp DEFAULT NULL,
      read INTEGER NOT NULL
    )
    

    I can’t find anything about Postgres allowing character sets per table, only that you would set UTF8 support using the UNICODE keyword when creating the database:

    CREATE DATABASE your_db WITH  ENCODING 'UNICODE';
    $ createdb -E UNICODE your_db --CLI version
    

    Postgre, like Oracle, uses sequences for AUTO_INCREMENT behavior:

    CREATE SEQUENCE example_seq START 1;
    

    Then, you need to call NEXTVAL([your sequence name]) in the insert statement to populate the primary key:

    INSERT INTO example (id) VALUES (NEXTVAL(example_seq))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 512k
  • Answers 512k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The difference here is that in the setTextSize(int size) method,… May 16, 2026 at 5:42 pm
  • Editorial Team
    Editorial Team added an answer There is but one simple answer: You cannot. Well, theoretically… May 16, 2026 at 5:42 pm
  • Editorial Team
    Editorial Team added an answer Probably you misunderstood toolbar parameter of the jqGrid. Perhaps you… May 16, 2026 at 5:42 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I try to translate this query into Criteria (with Propel), but without success. Can
I have a case where I need to translate (lookup) several values from the
So I have a webpage that queries some data based on this parameter search.php?state=AL
This is somewhat related to another question I asked: Translate GPS coordinates to location
This is a followup/post question to another question; as I have discovered a solution
In one of the ms-access table I work with we have a text field
I have a table Families, like so FamilyID PersonID Relationship ----------------------------------------------- F001 P001 Son
I have tried some ways to use LINQ dynamic queries - LINQKit and LINQ
I'm moving DB from MySQL (used ODBC) to MS SQL and I want to
I can't get the correct transformation in OpleGL. I have point3D - P(X,Y,Z), and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.